|
|
|
|
|
by thewayfarer
3112 days ago
|
|
> Wasting half your energy-budget on spoon feeding the compiler is just as bad as spending it on managing memory manually in C. This isn't quite a fair comparison. Manual memory management increases the risk of producing incorrect or buggy programs. Satisfying a strict compiler increases the chance that your program is written correctly. And for what it's worth, this boilerplate dance for "type erasure" will be solved with what the Swift team calls generalized existentials, where you'll be able to use nominal types like Any<Sequence where .Iterator.Element == String>. "Type erasure" isn't the result of "aiming so hard for perfection" as you say, but because Swift is still a young language and there is only so much the creators can work on at any one time. Most Swift devs (think iOS apps) aren't running up against this problem much, and I haven't seen a single situation in an app where implementing a "type erased" generic type was necessary. At this point in the Swift timeline, just making Swift code compile faster would make devs much happier. > it's still a mine field of exceptions Unlike languages that actually use exceptions, which really are mine fields of exceptions in a different sense :P |
|