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 dup set-word dup save-location ;
13 : CREATE-METHOD ( -- method )
14 scan-word bootstrap-word scan-word create-method-in ;
16 SYMBOL: current-method
18 : with-method-definition ( method quot -- )
19 over current-method set call current-method off ; inline
21 : (M:) ( method def -- )
22 CREATE-METHOD [ parse-definition ] with-method-definition ;