by srean · 2w ago · 0 comments
Exactly why I prefer simplicity. Exactly what I don't want my language to become. Single pass compilable does not precluded multiple passes for optimization.
D compiles very fast and has a cleaner design than C++. The latter has been trying hard to be a D wannabe for years. D's is not single pass compiled though.
BTW Modula-2 had coroutines. If I remember correctly they were stackless ones.
My point was part of C++'s complexity stems from the inability to push some of that complexity down the stack. A small amount of added complexity deeper in the broader ecosystem could eliminate much more complexity higher up the stack. Imagine if compilers and ABIs were architected to support efficient passing of discriminants, then option and union types could naturally become first-class and without any anxiety over performance or interoperability, rather than trying to implement them with more complex language facilities.
Languages evolve in a path dependent manner. If it's much more practical (in terms of time and effort) to implement a concept at a certain layer, that's where it'll be implemented. But unless your language is interpreted or emulated and your userbase values purity much greater than performance, the shape of the concept will reflect the capabilities and limitations of where and how it was implemented. The extra complexity of all those little accomodations can add up quickly, both in terms of implementation and language semantics.
It also works both ways. Moving a little complexity up the stack can substantially reduce overall complexity. But which direction is optimal varies. The problem is moving complexity down the stack isn't viewed as a realistic option these days, especially if you must take into consideration the viability of implementing it in core GCC or LLVM.
Apologies, I had misunderstood .