[swift-evolution] Reconsidering SE-0003 Removing var from Function Parameters and Pattern Matching

Jordan Rose jordan_rose at apple.com
Fri Jan 29 13:11:15 CST 2016


> On Jan 29, 2016, at 8:54, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> on Thu Jan 28 2016, Thorsten Seitz <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> 
>> 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.
>> 
>> if exists foo {
>>        // foo is non-optional here
>> }
>> 
>> if foo is String {
>>        // foo is of type String here
>> }
> 
> FWIW, some of us are concerned that if the types of names change
> without being announced by a let or var binding, it will be confusing.
> That's one reason we haven't gone this way in the past.

It's also problematic if 'foo' is mutable, because then it could go from being non-nil to being nil. You could restrict it to constants, but then it doesn't work on instance properties.

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160129/eb7d512a/attachment.html>


More information about the swift-evolution mailing list