classes.tuple: make error slots read only for small space savings

db4
Slava Pestov 2010-02-01 20:54:08 +13:00
parent 55a89ec9c2
commit a005e678db
1 changed files with 8 additions and 0 deletions

View File

@ -250,6 +250,13 @@ GENERIC# (define-tuple-class) 2 ( class superclass slots -- )
: thrower-effect ( slots -- effect )
[ name>> ] map { "*" } <effect> ;
: error-slots ( slots -- slots' )
[
dup string? [ 1array ] when
read-only swap remove
read-only suffix
] map ;
PRIVATE>
: define-tuple-class ( class superclass slots -- )
@ -265,6 +272,7 @@ M: tuple-class (define-tuple-class)
[ 2drop ?define-symbol ] [ redefine-tuple-class ] if ;
: define-error-class ( class superclass slots -- )
error-slots
[ define-tuple-class ]
[ 2drop reset-generic ]
[