[E-Lang] Thoughts on Persistence in E.

steve jenson stevej@sieve.net
Wed, 19 Sep 2001 05:26:31 -0700


Gang,

Having spent a few hours playing with persistence in E, using MarcS's
persistent echat.e as a beginning point for Serializer/Unserializer semantics,
as well as the org.erights.e.elib.serial package's source for other hints,
I've come to recognize a few things sofar with E's persistence.

I'm trying to use proper UpDoc syntax so that this email is easily testable
in an Elmer session. Serializer/Unserializer syntax is as follows:


? def ser__uriGetter := <unsafe:org.erights.e.elib.serial.*>
# value: <unsafe:org.erights.e.elib.serial.*>

? def Serializer := <ser:Serializer>
# value: <unsafe:org.erights.e.elib.serial.Serializer>

? def Unserializer := <ser:Unserializer>
# value: <unsafe:org.erights.e.elib.serial.Unserializer>

? var x := 1
# value: 1

? introducer onTheAir()
# value: ["3DES_SDH_M2", "3DES_SDH_M"]

? def counter {
>     to incr() :any { x += 1}
> }
# value: <counter>


? counter incr()
# value: 4


? def sr := sturdyRef(counter)
# value: <SturdyRef>

? var uri := introducer sturdyToURI(sr)
# value: "cap://66.92.8.63:33525/5agVa4XHV5D3F9G2=Vfpdd_fVDy/09uX50LDIp3kWLQKA8Z_ahVcWu6w"

Define a filename now.

? var filename := "/home/stevej/pickledCap.ser"
# value: "/home/stevej/pickledCap.ser"

? var file := <file: filename>
# value: <file:/home/stevej/pickledCap.ser>

? Serializer recordFile(file, [uri, sr])
No output here.. 

? def [newURI, newSR] := Unserializer playFile(file)
# value: ["cap://66.92.8.63:33525/5agVa4XHV5D3F9G2=Vfpdd_fVDy/09uX50LDIp3kWLQKA8Z_ahVcWu6w", <SturdyRef>]

? def farCounter := sr liveRef()
# problem: <NullPointerException>
#
#   <SturdyRef> liveRef()
#   <interactive interp> evalPrint(e`def farCounter :any := sr liveRef()`)

? println(uri)
cap://66.92.8.63:33525/5agVa4XHV5D3F9G2=Vfpdd_fVDy/09uX50LDIp3kWLQKA8Z_ahVcWu6w

? def newSR := introducer sturdyFromURI(uri)
# value: <SturdyRef>

? def farCounter := newSR liveRef()
# value: <Eventual ref>

? def newX := farCounter <- incr()
# value: <Eventual ref>

? newX
# value: 5



Notes based on this and other experiment:

0) I can serialize anything without an error being spit out.

1) I can successfully unserialize only strings and ints. 

2) While it appears that I can successfully deserialize a SturdyRef, when
   I attempt to call liveRef() on that SturdyRef, I get a 
   NullPointerException.

3) I cannot Unserialize class prototypes nor instantiations of classes. The
   value string spat out by Unserializer when I unserialize these is:
  #value: [<ref broken by problem: not persistent: <queue>>, <ref broken by problem: not persistent: <queueMaker>>

4) I cannot Unserialize functions which isn't shocking, as they are really
   objects under the hood.


E's persistence is new, I'm sure MarkM and gang are still smoothing out
all of the persistence qualities. I personally really like how you can 
keep objects together in a contextually close manner using Lists,
the only thing that would make it better is that instead of having to
explicitly remember the order in which things are Serialized, we could
pull them out by key, just like Python's 'shelve'.

Regardless, very cool!



cheers,
steve

-- 
steve jenson <stevej@sieve.net> http://sieve.net/
PGP fingerprint: 79D0 4836 11E4 A43A 0179  FC97 3AE2 008E 1E57 6138