4 ms·
Swift had generics in place from Day One. It also hides the generics when they don't need to be shown (like many collection types). I think that most of the st
by ChrisMarshallNY 6y ago
Swift had generics in place from Day One. It also hides the generics when they don't need to be shown (like many collection types).
I think that most of the standard language features are based on generics, but you would never know it, as a user of those features.
- apetrovic 6y agoTo be fair, Swift have a bit strange generics implementation that forces programmer to jumps through hoops to achieve something quite common in similar programming languages. The whole standard library is peppered with AnyThis and AnyThat, the language doesn't have generators (yield) and I'm not sure they're possible with the current generics design and programmers needs to learn what is type erasure just because the core team decided that returning generic interface from a function is something nobody will want. I like Swift a lot, for many reasons, but generics design isn't one of these reasons.
- ChrisMarshallNY 6y agoFair 'nuff. I was always a fan of the way C++ did it, but it was a great deal more technical. Swift is sort of "generics for the masses." C++ is a lot more powerful, but also a lot more "in your face." I really do like the way that Swift allows generics to have implicit types.
- icholy 6y agoCan't get enough of those template errors.