> I have a new proof of concept that allows ersatz to be embedded into a
> java program which then allows it to be multi-threaded ( I think.
> Still testing ). My assumption is that the static variables caused
> everything to be shared across the process. Removing the static
> keywords should open the door for multiple instances to be running in
> the same process. For single threaded apps, using static (as I
I think it depends on which level you thread the application.
- If you start multiple instances of Ersatz as individual threads of
some wrapper application (that's how I understand your concept above)
then the Lisp-level problems of threading can be avoided.
- If you thread the application (as we did in the previous mails) on the
Lisp level, the problems are not the static variables on the Java
level, but the fact that all threads share the same Lisp environment
(variable bindings, and I/O, 'make', 'protect, and other dynamic
environments). These problems are also in the C and asm versions if
one would try to thread them.
> understand it) will speed things up so it may not make sense to remove
> in the core code. Alex, is that why static is used?
> 1. Run mkJar to get a PicoLisp.java
> 2. Find/replace to remove all static keywords
> 3. Rename main, move logic that calls init & loops to separate method
This sounds reasonable.
It looks a bit like you simulate a fork() on the top level.
A true (fork) function in ErsatzLisp would be possible, not sooo simple
because it would involve copying all runtime data. I didn't want to do
that, because I was afraid of the overhead, but the above way of
starting separate instances has probably the same amount of overhead
(though much simpler to implement).