> On Sep 15, 2017, at 13:00, John McCall via swift-evolution
> <[email protected]> wrote:
>
>>
>> On Sep 15, 2017, at 3:45 PM, Joanna Carter via swift-evolution
>> <[email protected] <mailto:[email protected]>> wrote:
>>
>> Just came across this.
>>
>> I want to be able to hold onto the reference to a subscript "method" for
>> later use.
>>
>> Assigning the subscript to a var in the init of a type raises a segmentation
>> fault.
>>
>> Should this - could this - be allowed?
>
> It really shouldn't be allowed. I think KeyPaths are the intended language
> solution here.
>
> Please file a bug about the crash, though.
The crash is already fixed in master, thanks to Alex Hoppen's work on making
actual subscripts distinct from the name "subscript".
I think John's right that this should not be allowed. After all, a subscript
may have both a getter and a setter, and it's not immediately obvious from your
syntax which one you mean.
We could invent some kind of answer for this (including simply just checking
the contextual type), but it would be nice⢠if any such solution also had a
good answer for properties. Or we could just make key paths and closures work a
little better together, which has also been discussed on the list.
Jordan
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution