]> gitweb.factorcode.org Git - factor.git/commitdiff
don't use setter words from classes.struct boa>object, otherwise struct literals...
authorJoe Groff <arcata@gmail.com>
Tue, 18 Aug 2009 15:26:45 +0000 (10:26 -0500)
committerJoe Groff <arcata@gmail.com>
Tue, 18 Aug 2009 15:26:45 +0000 (10:26 -0500)
extra/classes/struct/struct.factor

index 90224c96d517aae8671831c4a1673e64e8afe887..d52c25e413a34e16e8c64d005941fa229d407aa6 100644 (file)
@@ -44,13 +44,17 @@ MACRO: <struct-boa> ( class -- quot: ( ... -- struct ) )
         ] bi
     ] [ ] output>sequence ;
 
-: pad-struct-slots ( slots class -- slots' class )
+: pad-struct-slots ( values class -- values' class )
     [ class-slots [ initial>> ] map over length tail append ] keep ;
 
+: (writer-quot) ( slot -- quot )
+    [ class>> c-setter ]
+    [ offset>> [ >c-ptr ] swap suffix ] bi prepend ;
+
 M: struct-class boa>object
     swap pad-struct-slots
-    [ (struct) swap ] [ "struct-slots" word-prop ] bi 
-    [ name>> setter-word execute( struct value -- struct ) ] 2each ;
+    [ (struct) ] [ "struct-slots" word-prop ] bi 
+    [ [ (writer-quot) call( value struct -- ) ] with 2each ] curry keep ;
 
 ! Struct slot accessors
 
@@ -59,10 +63,6 @@ M: struct-class reader-quot
     [ class>> c-type-getter-boxer ]
     [ offset>> [ >c-ptr ] swap suffix ] bi prepend ;
 
-: (writer-quot) ( slot -- quot )
-    [ class>> c-setter ]
-    [ offset>> [ >c-ptr ] swap suffix ] bi prepend ;
-
 M: struct-class writer-quot
     nip (writer-quot) ;