Comments inline.

> On Jun 2, 2017, at 2:38 AM, Daryle Walker <[email protected]> wrote:
> 
> 
>> On Jun 2, 2017, at 4:06 AM, Jaden Geller <[email protected]> wrote:
>> 
>> I don’t know if you’re aware, but you can extend arbitrary nominal types 
>> with literal syntax.
>> 
>> ```
>> extension FixedSizedArray: ExpressibleAsDictionaryLiteral { … }
>> ```
>> 
>> Nothing special needs to be done on the implementation side to make this 
>> possible. If fixed sized arrays are not nominal types (like tuples, unlike 
>> `Array`s), then you will only be able to give this sugar to types that wrap 
>> them, not the type itself (w/o special support).
> 
> I don’t think that’ll work with the “where” clauses and “default” values in 
> the new syntax.

I explained point-by-point which of these would be possible. If you reference 
the original message, I stated that the “where” sugar could instead be 
expressed with a lambda function. Personally, I’m against adding this new 
“where" sugar to the language, especially since the alternative seems no worse. 
I do think the “default” sugar is a good idea (as I stated there as well), but 
I don’t think it must be considered with fixed length arrays. It seems like an 
entirely additive and orthogonal feature.

> 
>> What’s the discussion on enhanced array and dictionary literals? I think I 
>> missed that.
> 
> This is the discussion. I’m asking if this “enhanced array” syntax I just 
> came up with would interfere with the existing dictionary syntax from a 
> parsing perspective.

I see. The first two cases (which are just normal dictionary syntax) are 
already possible. I don’t know about the third “where” case, but I don’t think 
it’s necessary. The 4th case seems possible since the keyword “default” cannot 
be used as an identifier.

> — 
> Daryle Walker
> Mac, Internet, and Video Game Junkie
> darylew AT mac DOT com 
> 

Cheers,
Jaden Geller
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to