multi-method-syntax: Nicer specializer syntax to hold me over till multi-methods are official

db4
Eduardo Cavazos 2008-11-29 12:08:20 -06:00
parent 14d00b3e83
commit 536b412d2e
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
USING: accessors effects.parser kernel lexer multi-methods
parser sequences words ;
IN: multi-method-syntax
! A nicer specializer syntax to hold us over till multi-methods go in
! officially.
!
! Use both 'multi-methods' and 'multi-method-syntax' in that order.
: scan-specializer ( -- specializer )
scan drop ! eat opening parenthesis
")" parse-effect in>> [ search ] map ;
: CREATE-METHOD ( -- method )
scan-word scan-specializer swap create-method-in ;
: (METHOD:) ( -- method def ) CREATE-METHOD parse-definition ;
: METHOD: (METHOD:) define ; parsing