3 ms·
It has been done before, but then you end up with a language twice as complicated as Go. Look at all the rules around initialization - constructors, temporaries
by int_19h 2y ago
It has been done before, but then you end up with a language twice as complicated as Go. Look at all the rules around initialization - constructors, temporaries, move semantics, RVO etc - in C++ for an example. If your goal is specifically to design a simple language, that is not a good path to go down.
FWIW my personal opinion is that the resulting complexity is necessary, and we as engineers just have to bite the bullet and deal with that mental overhead (and if it means that coding becomes too complicated for some, so be it). But the market ultimately decides; and it decided in favor of lots of code that's cheap and fast to write even at the expense of bugs, so we have tools catering specifically to that.
- School-Cotton 2y agoIt’s disingenuous to point to C++ as an example of essential complexity here. C++ is just extremely unnecessarily complex in every way. I’m not really aware of anywhere that lack of default zero initialization makes rust more complicated, for example.
- int_19h 2y agoI'm not claiming that C++ level of complexity is necessary, only that it is a widely known language with a lot of features that exist solely to enable this one thing. Rust can do this with less complexity by embracing choices that, while conceptually simple, are very unorthodox and unintuitive, such as everything being a move rather than a copy with few exceptions (whereas in pretty much every other PL it has always been the other way around, if move semantics is supported at all).