[swift-evolution] Sparse (fixed-size) array literal syntax
    Daryle Walker 
    darylew at mac.com
       
    Fri Jun  2 04:38:36 CDT 2017
    
    
  
> On Jun 2, 2017, at 4:06 AM, Jaden Geller <jaden.geller at gmail.com> 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.
> 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.
— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 
    
    
More information about the swift-evolution
mailing list