Almost all traditional languages ​​today are programmers' intentions as a text source, which is then (say, for simplicity) translated into some bytecode / machine code and interpreted / executed by VM / CPU.
There was another method, which for some reason is not so popular these days: “freeze” the runtime of your virtual machine and unload / serialize the environment (character bindings, state, code (whatever that is)) into an image that you can transfer , download and execute. As a result of this, you do not "write" your code in the usual way, but modify the environment with new characters, but in "run-time".
I see big advantages for this technique:
- Increased REPL level: you can analyze your code while writing it, partially evaluate it, test it directly and see the consequences of your changes. Then roll back if you mess up and do it again, or finish it on Wednesday. There is no need for a long compilation-debugging cycle;
- Some of the common problems associated with dynamic languages ​​(which cannot be compiled because the compiler cannot talk about environments statically) are forgotten: the interpreter knows where it is and can substitute links to characters with static offsets and perform other optimizations; / li>
- It’s easier in the programmer’s brain: you “unload” various contextual code data from your head, i.e. you don’t need to keep track of what your code has already done for any variable / data structure or which variable contains what: you see it right before your eyes! In the usual way (writing source), programmers add new abstractions or comments to the code to clarify intentions, but this can (and will) get confused.
Question: What are the disadvantages of this approach? Is there any serious flaw that I don't see? I know there are some problems with this, that is:
- try to create a modular system with it, which will not lead to a freeze in hell or serious problems with binding.
- safety problems
- try versioning such images and enable concurrent development.
But they, IMHO, are solvable with a good construction.
EDIT1: regarding the status of “closed, primarily opinion-based”. I have described two existing approaches, and it is clear and obvious that one is preferable to the other. Regardless of whether the reasons for this are purely “opinion-based” or whether there is a need for a second search for it, I do not know, but even if they are based on opinions, if someone lists these reasons for such a conclusion, I must actually answer my question.
source share