Re: string_exec()
- Posted by dcuny Mar 06, 2015
- 2011 views
What I had envisioned includes the ability to modify true top-level code and then re-execute it.
My concern is that you'll effectively be in the middle of the top-level code:
-- this string_exec(...) -- that
If I understand your scheme, it would effectively become:
-- this string_exec(...) -- code generated by string_exec() <-- code begins re-executing here -- that
Is that correct?
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.
I believe using the routine_id mechanism solves this issue a bit more cleanly... although I'll confess having a love/hate relationship with routine_id.
If the request is allowing self-modifying code, what exactly does that mean? Can a routine be redefined?
Yes.
It seems you can get the same result via routine_id, at a much cheaper cost.
- David