IL Engineering Library

new topic     » topic index » view thread      » older message » newer message

Forked from Re: string_exec()

katsmeow said...

Which is why i suggested it be converted to IL code or compiled or whatever the wizardry du jour is, and the result inlined (or gosub'd) where it was called. That automatically restricts it to the same scope as the include file and the procedure containing it.

It really sounds like you do not want an eval() function at all. Instead, you want something like http://commons.apache.org/bcel/

Adding functionality to allow Euphoria IL to be directly modified (read&write) live, at run time, is simple enough. Dealing with raw IL is somewhat like dealing with raw Java bytecode (all numbers and no human readable words) - but we already have some tools like the shrouder and eudis which converts between the two. So with some simple changes, you could call the shrouder to compile your Euphoria code into IL, then inject that IL into your running program. This sounds like it'd do exactly what you are asking for, IIUC.

It'd go something like this:

include euphoria/shrouder.e -- new include based on bind.ex 
 
? 0 
sequence newIL = shrouder:shroud("atom a a = 1 ? a") 
integer pos = get_il_current_pos() -- new builtin 
inject_il_at(pos, newIL) -- new builtin 
? 2 

Output:

0 
1 
2 
new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu