defining a generic on something that is not a class would ruin the generic

cvs
Slava Pestov 2005-04-25 23:56:56 +00:00
parent 8b496e60ff
commit 6ff40d6cf3
2 changed files with 4 additions and 1 deletions

View File

@ -74,6 +74,9 @@ math-internals ;
: define-method ( class generic definition -- )
-rot
over metaclass word? [
word-name " is not a class" append throw
] unless
[ "methods" word-prop set-hash ] keep dup <vtable>
make-generic ;

View File

@ -156,4 +156,4 @@ M: number union-containment drop 2 ;
! Testing recovery from bad method definitions
"GENERIC: unhappy" eval
[ "M: vocabularies unhappy ;" eval ] unit-test-fails
[ ] [ "GENERIC: unhapy" eval ] unit-test
[ ] [ "GENERIC: unhappy" eval ] unit-test