[Aldor-l] Fluids
Pippijn van Steenhoven
pip88nl at gmail.com
Thu Sep 10 11:55:57 EDT 2009
Hi,
fluid variables are used in various places in the compiler. I don't know
whether I understand them correctly, but as far as I can tell, it is a
bit like perl's "local". A global variable is modified and restored after
the scope ends. Ending a scope is either done with Unscope, which just
unwinds the fluid stack up to the last Scope entry or with Return, which
does the same but also returns a value (or not, when passed Nothing).
There is also a thing called LongJmp which is used in the foam
interpreter and interactive loop. In the REPL, it is used to jump from a
signal handler back into the loop (after a fault or break). In the
interpreter, I have no idea. The JmpBuf used in fint's LongJmps is never
initialised. Reaching one of those LongJmps would result in a
segmentation fault (with all registers set to 0). Apparently, control
never does reach that code, normally, because I have never seen faults
like that.
Also, the REPL jumping part is highly inadvisible. For instance, it will
not work on intel itanium with optimisation turned on. Itanium has user
space CPU scheduling which interferes with the strange jumping behaviour.
Jumping out of a signal handler may also introduce strange bugs, because
every single instruction can throw control back from a place where global
state may have been modified in unexpected ways. Besides that, it is
simply undefined behaviour and nobody knows what really happens.
Can anyone explain the fint jumps? They seem to be stale. I'll
investigate some more, whether the code is ever reached.
--
Pippijn van Steenhoven
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://aldor.org/pipermail/aldor-l_aldor.org/attachments/20090910/4e4212ab/attachment.bin>
More information about the Aldor-l
mailing list