<div dir="ltr">I think that we should change it to `if. Inline filtering is useful, even if it isn't used much at present but the inconsistency doesn't help adoption.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 24, 2016 at 11:06 AM, Sean Heber via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I’ll share some of mine from a single game project. Note this hasn’t been converted to Swift 3 and this is not all of them - just a varied sampling:<br>
<br>
<br>
for location in random.sample(map, density: 0.007) where map.allowsGrassAt(location) && !map.hasGrassAt(location) {<br>
}<br>
<br>
for location in type.designatedLocations where location.z == Global.cameraZ && !locations.contains(location) {<br>
}<br>
<br>
for location in region where location.z == mouseLocation.z {<br>
}<br>
<br>
for location in path where location.z == Global.cameraZ {<br>
}<br>
<br>
for below in location.below.cardinals where contains(below) && hasSurfaceAt(below) {<br>
}<br>
<br>
for neighbor in location.cardinals where contains(neighbor) && isRampAt(neighbor) && !isFloorAt(neighbor.above) {<br>
}<br>
<br>
for neighbor in cardinals where contains(neighbor) && !isSolidAt(neighbor) {<br>
}<br>
<br>
for console in consoles.reverse() where console.hitTest(vector) {<br>
}<br>
<br>
<br>
<br>
And these 2 made good use, IMO, of “if-where” but I think that’s no longer in Swift 3? :/<br>
<br>
<br>
if let there = debugClickedSurfaceAt, here = mouseSurface where Global.debugPathTest {<br>
}<br>
<br>
if let here = mouseAt where Global.debugWalkNeighbors {<br>
}<br>
<br>
<br>
l8r<br>
Sean<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
> On Jun 24, 2016, at 8:24 AM, Erica Sadun via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
><br>
> Thank you for collecting and sharing these.<br>
><br>
> I suspect both of us look at these and say "Ah yes, this supports exactly what I've been saying".<br>
><br>
> -- E<br>
><br>
>> On Jun 23, 2016, at 11:59 PM, William Shipley <<a href="mailto:wjs@mac.com">wjs@mac.com</a>> wrote:<br>
>><br>
>> Here are some of my real-world examples:<br>
>><br>
>> for modelUUIDAndInterfaceElement in modelUUIDsToInterfaceElements where !usedInterfaceElements.contains(modelUUIDAndInterfaceElement.1) {<br>
>> …<br>
>> }<br>
>><br>
>> for anchor in wall.anchors where boundsRect.contains(anchor.origin) {<br>
>> …<br>
>> }<br>
>><br>
>> for otherWall: Wall in self where otherWall != wall && !removedWalls.contains(otherWall) {<br>
>> …<br>
>> }<br>
>><br>
>> for wall in self as Set<Wall> {<br>
>> for otherWall in self as Set<Wall> where otherWall != wall {<br>
>> …<br>
>> }<br>
>> }<br>
>><br>
>> for wall in self as Set<Wall> where !checkedWalls.contains(wall) {<br>
>> …<br>
>> }<br>
>><br>
>> (x2 on that one)<br>
>><br>
>> for otherPieceOfFurnitureNode in localFurnitureModelUUIDsToInterfaceElements!.values where otherPieceOfFurnitureNode !== pieceOfFurnitureNode {<br>
>> …<br>
>> }<br>
>><br>
>> for lineSegmentObject in wallRelatedLineSegments where remainingLineSegments.contains(lineSegmentObject) {<br>
>> …<br>
>> }<br>
>><br>
>> for colinearLineSegmentObject in remainingLineSegments where colinearLineSegmentObject.angle.isEssentially(infiniteLineAngle: lineSegmentObject.angle) {<br>
>> …<br>
>> }<br>
>><br>
>><br>
>> I think this is basically as many as are found on all of github?<br>
>><br>
>> -W<br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> _______________________________________________<br>
> swift-evolution mailing list<br>
> <a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
> <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</div></div></blockquote></div><br></div>