<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>This is called flow typing in Ceylon and they are using "exists" for that case but testing for conformance with "is" works just the same way there. The latter is of importance because the common use of union types in Ceylon.</div><div><br></div><div>if exists foo {</div><div> // foo is non-optional here</div><div>}</div><div><br></div><div>if foo is String {</div><div> // foo is of type String here</div><div>}</div><div><br></div><div>-Thorsten</div><div><br>Am 28.01.2016 um 19:08 schrieb Jacob Bandes-Storch via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>>:<br><br></div><blockquote type="cite"><div><div dir="ltr"><div> if bind foo {</div><div> // foo is non-optional in here</div><div> }</div><div><br></div><div> somethingAsync { [weak self] in</div> guard bind self else { return }<div> // ...<br><div> }<br><div class="gmail_extra"><br></div><div class="gmail_extra">Elegant when you want to rebind the same name!</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div>Jacob<br></div></div></div></div>
<br><div class="gmail_quote">On Thu, Jan 28, 2016 at 10:05 AM, Erica Sadun 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">Do you realize how much confusion it would save if Swift just went with<br>
<br>
if bind foo = bar {...}<br>
<br>
with let semantics?<br>
<br>
-- Erica<br>
<div class="HOEnZb"><div class="h5"><br>
> On Jan 28, 2016, at 11:03 AM, Joe Groff via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
><br>
><br>
>> On Jan 28, 2016, at 12:43 AM, Brent Royal-Gordon <<a href="mailto:brent@architechies.com">brent@architechies.com</a>> wrote:<br>
>><br>
>>> We have a lot of evidence that 'if var' confuses peopleāa lot of users think that 'if var' and 'var' bindings in case patterns will write back to the original value when this isn't the case.<br>
>><br>
>> Can we address this with a diagnostic?<br>
>><br>
>> var bar: Int? = 1<br>
>> if var foo = bar {<br>
>> foo += 1 // Warning: Value is never used after modification (foo is a copy, not an alias)<br>
>> }<br>
>> print(bar)<br>
><br>
> Good idea.<br>
><br>
> -Joe<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>
<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></div></div></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>