1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: parser kernel words generic namespaces inspector ;
6 ERROR: not-in-a-method-error ;
8 M: not-in-a-method-error summary
9 drop "call-next-method can only be called in a method definition" ;
11 : CREATE-GENERIC ( -- word ) CREATE dup reset-word ;
13 : create-method-in ( class generic -- method )
14 create-method f set-word dup save-location ;
16 : CREATE-METHOD ( -- method )
17 scan-word bootstrap-word scan-word create-method-in ;
20 SYMBOL: current-generic
22 : with-method-definition ( quot -- parsed )
25 [ "method-class" word-prop current-class set ]
26 [ "method-generic" word-prop current-generic set ]
31 : (M:) ( method def -- )
32 CREATE-METHOD [ parse-definition ] with-method-definition ;