3 ms·
> Third, RAII is in practice little more powerful than lexical scoping. I'm beginning to think that we're all going about things wrong :) . We like and rely on
by charlieflowers 10y ago
> Third, RAII is in practice little more powerful than lexical scoping.
I'm beginning to think that we're all going about things wrong :) . We like and rely on things like RAII, macros, etc. But these are nothing more than specific compiler features.
If we were to take control of generating our own code, we could have RAII, macros, and whatever else we dreamed up, easily. And the generated code could be in some readable, debuggable language, so much more visible and obvious than the results of a macro expansion.
For so long we've relied on an amazing black box called a "compiler", when perhaps we should take on the responsibility ("power") of implementing a compiler ourselves. (We could still, of course, generate some intermediate mainstream language, and then those amazing black boxes could take that as input and apply all their optimizations.
Seems to yield clearer code, less magic, more power, and more portability.