1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: parser kernel words generic namespaces ;
6 ERROR: not-in-a-method-error ;
8 : CREATE-GENERIC ( -- word ) CREATE dup reset-word ;
10 : create-method-in ( class generic -- method )
11 create-method f set-word dup save-location ;
13 : CREATE-METHOD ( -- method )
14 scan-word bootstrap-word scan-word create-method-in ;
17 SYMBOL: current-generic
19 : with-method-definition ( quot -- parsed )
22 [ "method-class" word-prop current-class set ]
23 [ "method-generic" word-prop current-generic set ]
28 : (M:) ( method def -- )
29 CREATE-METHOD [ parse-definition ] with-method-definition ;