]> gitweb.factorcode.org Git - factor.git/blob - unmaintained/multi-method-syntax/multi-method-syntax.factor
4a5cc7cc29b2aef900defc47cced0cf8bde35a86
[factor.git] / unmaintained / multi-method-syntax / multi-method-syntax.factor
1
2 USING: accessors effects.parser kernel lexer multi-methods
3        parser sequences words ;
4
5 IN: multi-method-syntax
6
7 ! A nicer specializer syntax to hold us over till multi-methods go in
8 ! officially.
9 !
10 ! Use both 'multi-methods' and 'multi-method-syntax' in that order.
11
12 : scan-specializer ( -- specializer )
13
14   scan drop ! eat opening parenthesis
15
16   ")" parse-effect in>> [ search ] map ;
17
18 : CREATE-METHOD ( -- method )
19   scan-word scan-specializer swap create-method-in ;
20
21 : (METHOD:) ( -- method def ) CREATE-METHOD parse-definition ;
22
23 : METHOD: (METHOD:) define ; parsing