Use new-slots in serialize
parent
ce600b6aec
commit
3c95b7813a
|
@ -11,7 +11,8 @@ USING: namespaces sequences kernel math io math.functions
|
||||||
io.binary strings classes words sbufs tuples arrays
|
io.binary strings classes words sbufs tuples arrays
|
||||||
vectors byte-arrays bit-arrays quotations hashtables
|
vectors byte-arrays bit-arrays quotations hashtables
|
||||||
assocs help.syntax help.markup float-arrays splitting
|
assocs help.syntax help.markup float-arrays splitting
|
||||||
io.encodings.string io.encodings.utf8 combinators ;
|
io.encodings.string io.encodings.utf8 combinators new-slots
|
||||||
|
accessors ;
|
||||||
|
|
||||||
! Variable holding a assoc of objects already serialized
|
! Variable holding a assoc of objects already serialized
|
||||||
SYMBOL: serialized
|
SYMBOL: serialized
|
||||||
|
@ -20,9 +21,9 @@ TUPLE: id obj ;
|
||||||
|
|
||||||
C: <id> id
|
C: <id> id
|
||||||
|
|
||||||
M: id hashcode* id-obj hashcode* ;
|
M: id hashcode* obj>> hashcode* ;
|
||||||
|
|
||||||
M: id equal? over id? [ [ id-obj ] 2apply eq? ] [ 2drop f ] if ;
|
M: id equal? over id? [ [ obj>> ] 2apply eq? ] [ 2drop f ] if ;
|
||||||
|
|
||||||
: add-object ( obj -- )
|
: add-object ( obj -- )
|
||||||
#! Add an object to the sequence of already serialized
|
#! Add an object to the sequence of already serialized
|
||||||
|
|
Loading…
Reference in New Issue