[swift-evolution] Three quick(ish) generics enhancements;	*maybe* phase 1
    Dave Abrahams 
    dabrahams at apple.com
       
    Sat Dec 24 11:03:41 CST 2016
    
    
  
on Thu Dec 22 2016, David Sweeris <swift-evolution at swift.org> wrote:
> I want to revisit some specific generics idea that, IIRC, were
> generally well-recieved at the time, but the conversation died down
> and nobody got around to writing formal proposals. I want to revisit
> them now (as opposed to in phase 2) because I don’t know how much
> “growing room” there is in the ABI for generics to gain features. It’d
> be a shame to close the door on these simply because nobody said
> anything. Anyway...
>
>
> 1) Allow generic parameters to have optional labels: struct Array
> <Element T> {…} //`let x = Array<Element: Double>` Not the best
> example, though, since I’d definitely argue against adding a label
> here
> 2) Allow literals as generic arguments: struct Array <T, Length: Int>
> {…} //Allows for `let x = Array<Double, Length: 10>()`
> 3) Allow generic parameters to have default values: struct Array <T,
> Length: Int, FixedSize: Bool = false> {…} //The `let x…` from above
> still works, as well as `let y = Array<Double, Length: 10, FixedSize:
> true>()`
I want all the features you've listed... someday.  They're purely
additive, so there's no urgency to discuss them now, IMO.
-- 
-Dave
    
    
More information about the swift-evolution
mailing list