[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: es dumps core, aargh...
> Here is a minimal version of the same problem. This dumps core:
>
> ; echo <={@ x{x=@{$*}; $&result $x}}
>
> why? check this one first:
>
> ; echo <={@ x{$&result @{$*}} X}
> %closure(x=X)@ * {$*}
>
> Now, imagine replacing X by the entire closure, and you have a closure
> containing a reference to itself. That can never be printed, of
> course.
I never got the story right on circular references in es. Considering
that that was the reason I gave it a garbage collector as opposed to
simpler memory management -- and spent a fairly long time getting the
root set identification right -- I feel pretty silly.
The right answer might be to do something like a Lisp printer does with
#n= and #n# syntax. (See *PRINT-CIRCLE* in your favorite Common Lisp
reference for details.) But that doesn't solve the other problem caused
by pickling objects into parseable program text: shared state that
becomes unshared upon reparsing.
--p