3 ms·
> ... often added in haphazard fashion late in the language specs Agreeing with this point. I feel, there seems to be a vicious cycle in "pragmatic" language d
by xg15 8y ago
> ... often added in haphazard fashion late in the language specs
Agreeing with this point. I feel, there seems to be a vicious cycle in "pragmatic" language design that goes something like this:
1) Let's design language n. It will be like language n-1 in spirit but much more lightweight and without all the historical baggage!
2) In particular, let's leave out generics. They have been a never-ending source of bugs and confusion in n-1 development, with all the gotchas and awkward special cases you need to remember - and we can't really think of any compelling real-world use-cases for them anyway...
(... some years later ...)
3) Sigh... the community keeps pestering us about generics... so alright, we'll think about some way to add generics to the language so you guys finally stop complaining.
4) Behold: We made n', a language extension to n with generics. However, because all of our existing ecosystem is written in the old way, without generics, we had to prioritize backwards compatibility over all else during the design. That's why you'll have to live with counter-intuitive behavior A, awkward special case B and arbitrary-looking restriction C when using them. We're sorry, guys!
5) Let's design language n+1. It will be like language n in spirit but much more lightweight and without all the historical baggage! Especially generics!
How about for a change designing a language where generics are part of the initial design instead of just getting bolted on later?
- SideburnsOfDoom 8y ago> How about for a change designing a language where generics are part of the initial design instead of just getting bolted on later? Muttering about Rust at this point. Exactly. Generics being there from the get-go makes a difference to the language design. The most visible example being how values are returned from functions, when the result is tuple return for success case or error case. Bolting that on later is unlikely to work well. https://doc.rust-lang.org/std/result/ https://doc.rust-lang.org/std/result/
- eitland 8y agoWell, C# and TypeScript both seems to have gotten a whole lot more right (I'll cut TypesScript some extra slack here since it has to take extra care not to step on JavaScripts toes now or in the future.)
- SideburnsOfDoom 8y agoGenerics came to C# in version 2.0. Although it was done well, there is no doubt that some things would have been different if there were generics in Version 1.