classes: optimize instance? for classoids

db4
Doug Coleman 2011-11-22 20:38:07 -08:00
parent 17cc8ad1f3
commit f90bc5cdb6
3 changed files with 7 additions and 4 deletions

View File

@ -302,7 +302,7 @@ generic-comparison-ops [
] "outputs" set-word-prop ] "outputs" set-word-prop
\ instance? [ \ instance? [
[ value-info ] dip over literal>> class? [ [ value-info ] dip over literal>> classoid? [
[ literal>> ] dip predicate-constraints [ literal>> ] dip predicate-constraints
] [ 3drop f ] if ] [ 3drop f ] if
] "constraints" set-word-prop ] "constraints" set-word-prop
@ -311,10 +311,10 @@ generic-comparison-ops [
! We need to force the caller word to recompile when the class ! We need to force the caller word to recompile when the class
! is redefined, since now we're making assumptions but the ! is redefined, since now we're making assumptions but the
! class definition itself. ! class definition itself.
dup literal>> class? dup literal>> classoid?
[ [
literal>> literal>>
[ depends-on-conditionally ] [ depends-on-class ]
[ predicate-output-infos ] [ predicate-output-infos ]
bi bi
] [ 2drop object-info ] if ] [ 2drop object-info ] if

View File

@ -177,7 +177,7 @@ ERROR: bad-partial-eval quot word ;
\ new [ inline-new ] 1 define-partial-eval \ new [ inline-new ] 1 define-partial-eval
\ instance? [ \ instance? [
dup class? dup classoid?
[ predicate-def ] [ drop f ] if [ predicate-def ] [ drop f ] if
] 1 define-partial-eval ] 1 define-partial-eval

View File

@ -32,3 +32,6 @@ M: maybe union-of-builtins?
M: maybe class-name M: maybe class-name
class>> name>> ; class>> name>> ;
M: maybe predicate-def
class>> predicate-def [ [ t ] if* ] curry ;