Re: Newbie questions about persistence
Thomas Leonard <tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]>
| Newsgroups | gmane.comp.lang.e.general |
|---|---|
| Organization | IT Innovation |
| Message-ID | <[email protected]> |
On Tue, 2009-09-01 at 16:08 +0100, Thomas Leonard wrote:
> On Fri, 2009-08-28 at 19:15 -0400, Kevin Reid wrote:
> > On Aug 28, 2009, at 10:27, Thomas Leonard wrote:
[...]
> > > Persistence of cycles
> > >
> > > Some cyclic data structures can be persisted, while others can't (is
> > > this a bug?). I haven't worked out what the rule is, but I do have
> > > some examples:
> > ...
> > > Serializing [[<***CYCLE***>], [<***CYCLE***>]]...
> > > Serialized as de: [def t__0 := [t__0], t__0]
> > > # problem: <IndexOutOfBoundsException: not found: t__0>
> > >
> > > This is quite annoying, because a SwissRetainer includes a pointer to
> > > its object, in addition to the pointer in the table for which the
> > > retainer is a key. Therefore, an object containing a single cycle ends
> > > up with the broken double-cycle structure when saved.
> >
> > This is a bug. Please send versions, test cases, patches, etc.
>
> A minimal test case is:
>
> def surgeon := <elib:serial.makeSurgeon>.withSrcKit("de: ")
> surgeon.unserialize("de: [def t__0 := [t__0], t__0]")
>
> which gives:
>
> # problem: <IndexOutOfBoundsException: not found: t__0>
>
> Happens with the current release (0.9.2a) and svn versions of E.
Is there any reason not to unserialize Data-E using e.g.
eParser(s).eval(privilegedScope)?
That avoids this bug, and is about 10x faster, too.
? surgeon.unserialize("[def t__0 := [t__0], t__0]")
# problem: <IndexOutOfBoundsException: not found: t__0>
? eParser("[def t__0 := [t__0], t__0]").eval(safeScope)
# value: [[<***CYCLE***>], [<***CYCLE***>]]
--
Dr Thomas Leonard
IT Innovation Centre
2 Venture Road
Southampton
Hampshire SO16 7NP
Tel: +44 0 23 8076 0834
Fax: +44 0 23 8076 0833
mailto:tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]
http://www.it-innovation.soton.ac.uk