Re: string_exec()
- Posted by jimcbrown (admin) Mar 06, 2015
- 1907 views
I was under the impression that what katsmeow really wanted was dynamic/self-modifying code + REPL. OTOH, the entire kitchen sink. Which is something I support.
I got that impression as well. I'm just trying to figure out how the mechanics of that would work.
I'm just trying to understand what's being ask for.
Logical.
There are a couple bits that aren't clear to me. The where does "top level" code is one of them.
What I had envisioned includes the ability to modify true top-level code and then re-execute it.
So top level code would continue to live in the top level, with no special scoping or protection from pre-existing top level code.
Ironically, top level code is the easiest to deal with in a BCEL library since there's fewer internal data structures that need to be rearranged to deal with it (as compared to creating a whole new routine, for example).
The other is how existing code gets to know about the new routines, since none of it was visible at the time of compilation.
This is hard to do since in addition to IL itself we'd have to update the internal data structures that manage routines. But the goal is to allow one to write whole new routines on the fly and call them.
If the request is allowing self-modifying code, what exactly does that mean? Can a routine be redefined?
Yes.
I think what I've suggested answers both of those questions, but doesn't answer the question of how to add top-level variables.
This also requires modifying internal data structures, but it's probably a little easier than deal with routines.