> A first tiny step towards more safety would be empowering typealias and 
> generate warnings when a function is used with the "wrong" parameter type 
> ("Kelvin" requested, but plain Float given).
> Additionally, extensions written for a typealias shouldn't be treated like 
> extensions for the underlying type.
> An extra benefit of this would be the possibility to have
> typealias Path = String
> and make a clean distinction between general String-methods and those that 
> are only relevant for Strings that represent a Path in the file system — it 
> would even be possible to generate failable initializers to document 
> constraints of the "new" type.

There's been discussion of this before, actually. Search the archives for 
`newtype`, which is Haskell's version of this feature.

-- 
Brent Royal-Gordon
Architechies

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

Reply via email to