2 ms·
One could say that for any feature that a language got later on and everybody feels fine with it added. Go/Java and generics for example. C++ and auto or closu
by coldtea 4y ago
One could say that for any feature that a language got later on and everybody feels fine with it added.
Go/Java and generics for example. C++ and auto or closures. Javascript and async/await ("just learn regular Javascript async patterns").
The thing is C could have had a string type that knows its length since day one, with known performance tradeoffs, and also allow for everybody to build their own type in the more rare cases where it's needed.
And most of buffer overflow and string handling bugs would have been avoid, as most of the programs using them don't need the performance or special handling of C strings (or don't need them where the bugs occur, e.g. when reading some configuration file).
- pjmlp 4y agoIndeed, stuff like sds should have long been available as vocabulary types.
- throwaway894345 4y agoGo/Java is a weird one. I don't see many instances of generics in the wild. Honestly the biggest benefit I enjoy is that people who never intended to use Go in the first place are slightly less loud about Go's position on generics. Beyond that, it's a small quality of life improvement to only have to define min and max once for all of my integer types (incidentally, this is really only a problem in Go because it's so dang easy/convenient to create your own int types, whereas in Rust, Java, TypeScript etc it seems like everyone just uses the standard int types for everything).