defining a generic on something that is not a class would ruin the generic
parent
8b496e60ff
commit
6ff40d6cf3
|
@ -74,6 +74,9 @@ math-internals ;
|
||||||
|
|
||||||
: define-method ( class generic definition -- )
|
: define-method ( class generic definition -- )
|
||||||
-rot
|
-rot
|
||||||
|
over metaclass word? [
|
||||||
|
word-name " is not a class" append throw
|
||||||
|
] unless
|
||||||
[ "methods" word-prop set-hash ] keep dup <vtable>
|
[ "methods" word-prop set-hash ] keep dup <vtable>
|
||||||
make-generic ;
|
make-generic ;
|
||||||
|
|
||||||
|
|
|
@ -156,4 +156,4 @@ M: number union-containment drop 2 ;
|
||||||
! Testing recovery from bad method definitions
|
! Testing recovery from bad method definitions
|
||||||
"GENERIC: unhappy" eval
|
"GENERIC: unhappy" eval
|
||||||
[ "M: vocabularies unhappy ;" eval ] unit-test-fails
|
[ "M: vocabularies unhappy ;" eval ] unit-test-fails
|
||||||
[ ] [ "GENERIC: unhapy" eval ] unit-test
|
[ ] [ "GENERIC: unhappy" eval ] unit-test
|
||||||
|
|
Loading…
Reference in New Issue