4 ms·
How about a language that loses the ability to redefine structures and methods after a certain point? I've been thinking of making a scripting language where y
by jtolmar 8y ago
How about a language that loses the ability to redefine structures and methods after a certain point?
I've been thinking of making a scripting language where you can freely redefine things until you return the main function to the script's caller. At that point main gets compiled / JITed / otherwise locked and any redefinitions done by calling it are errors.
- white-flame 8y agoOr even just a manual bake() call, with an expensive unbake() to use during development (or maybe even deployed if it's that reconfigurable). But I do agree that a tool like this should affect the global environment and not try to be fine grained. Leave any fine-grained decisions up to the VM itself.
- staticassertion 8y agoSounds like macros.
- yorwba 8y agoThat's how RPython works, essentially. https://rpython.readthedocs.io/en/latest/getting-started.html https://rpython.readthedocs.io/en/latest/getting-started.htm...
- zbentley 8y ago> How about a language that loses the ability to redefine structures and methods after a certain point? Sounds awesome! We could call the phases before that point "compile time" and "preprocessor time", and the phase after that point "run time". /sarc
- yorwba 8y agoMost languages lack one of these phases. C/C++ and the C preprocessor are completely different languages, you can't execute C code during preprocessing. That's annoying and the reason for the introduction of constexpr in C++11. Other languages are too dynamic to be handled by a static compiler, but might benefit if you could transition to optimized machine code at runtime. Except for Lisp, I don't think there are many other languages where such a thing is possible.