Use new-slots in serialize

db4
Slava Pestov 2008-03-11 21:59:09 -05:00
parent ce600b6aec
commit 3c95b7813a
1 changed files with 4 additions and 3 deletions
extra/serialize

View File

@ -11,7 +11,8 @@ USING: namespaces sequences kernel math io math.functions
io.binary strings classes words sbufs tuples arrays
vectors byte-arrays bit-arrays quotations hashtables
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
SYMBOL: serialized
@ -20,9 +21,9 @@ TUPLE: id obj ;
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 an object to the sequence of already serialized