You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I understand, in Jx9 I cannot execute a second Jx9 script on an existing VM. Yet I have at least two use-cases that would make it useful:
Compiling/executing a large script that defines a bunch of functions, followed by compiling/executing much smaller scripts that execute these functions. In this situation the large script could be compiled at start-up and the smaller scripts would be compiled on-demand. Right now the only way to do that is to concatenate the two scripts, and re-compile the first long script every time I get a new small script to execute.
Statefull VMs: I know that in the context of unqlite, any state that needs to be persistent across Jx9 executions can be stored in the database, but in the context of just having an embedded Jx9 engine, it would be useful for the VM to keep its state and be able to compile and execute further scripts (think of the implementation of a jx9 REPL, as an example).
A possible API for this would be:
jx9_compile_more(jx9_vm* pVm, const char *zSource, int nLen, ): compiles and append additional code and makes the VM ready to execute it (i.e. if the previous code hasn't been executed, jx9_vm_exec will start by executing it, otherwise the next call to jx9_vm_exec will start executing from the new code), without touching any variable/functions/callbacks that have already been defined in the VM.
jx9_vm_copy(jx9_vm* pVm, jx9_vm** pNewVm); copies the state of the VM into a new VM.
Note that the same comment applies to PH7.
The text was updated successfully, but these errors were encountered:
As far as I understand, in Jx9 I cannot execute a second Jx9 script on an existing VM. Yet I have at least two use-cases that would make it useful:
A possible API for this would be:
jx9_compile_more(jx9_vm* pVm, const char *zSource, int nLen, )
: compiles and append additional code and makes the VM ready to execute it (i.e. if the previous code hasn't been executed, jx9_vm_exec will start by executing it, otherwise the next call to jx9_vm_exec will start executing from the new code), without touching any variable/functions/callbacks that have already been defined in the VM.jx9_vm_copy(jx9_vm* pVm, jx9_vm** pNewVm);
copies the state of the VM into a new VM.Note that the same comment applies to PH7.
The text was updated successfully, but these errors were encountered: