[swift-evolution] Make generics covariant and add generics to protocols

Brent Royal-Gordon brent at architechies.com
Thu Jan 14 02:39:23 CST 2016


> It doesn't make the type system unsound; the types are mostly checked at compile time but some are runtime checked, either way the types are checked and therefore the type system is sound.

Runtime type checking is not an adequate replacement for compile-time type checking. Runtime type checking ensures your code does not continue to run if it encounters a type error; compile-time type checking ensures your code is *incapable of encountering* a type error. This is a bit like saying that it's okay to drive drunk because seatbelts and airbags will mitigate the injuries caused if you crash.

Swift has a lovely property where, if your code is typed strongly enough and compiles without errors, it's probably pretty close to working. I would hate to see that watered down.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list