On 9 Oct 2006, at 12:23 pm, ricardolinerotorres wrote:
> ok..so not all core objects can be serialize....
>
> how about the ones i create?...
>
> like..
>
>
> person:= Object clone do(
>
>
> name:="max power"
> age:="55"
> occupation:="lawyer"
>
> returnInfo:=method(
>
> writeln(name)
> writeln(age)
> writeln(occupation)
>
> )
>
> )
>
> can i serialize this??....and how can i get it back from the file
> and place in some code??
You could write a few methods like:
Object serialized := method(s,
if(s == nil, s := Sequence clone)
self slotNames foreach(n,
s appendSeq(n, " := ", self getSlot(n) serialized
)
)
and:
Method serialized := method(self asString)
except that it couldn't deal with reference loops, etc (no
non-"image" based system can properly deal with serialization).
- Steve
.