4 ms·
To be fair, Swift have a bit strange generics implementation that forces programmer to jumps through hoops to achieve something quite common in similar programm
by apetrovic 6y ago
To 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.