more generic work

cvs
Slava Pestov 2004-12-11 23:27:02 +00:00
parent ee5fc9575d
commit 11e98d9fd4
1 changed files with 10 additions and 1 deletions

View File

@ -145,8 +145,17 @@ SYMBOL: delegate
#! traits type. #! traits type.
scan-word [ constructor-word ] keep [ (;C) ] [ ] ; parsing scan-word [ constructor-word ] keep [ (;C) ] [ ] ; parsing
: (;M) ( type generic definition -- )
pick builtin-type [
rot "builtin-type" word-property
rot "vtable" word-property
set-vector-nth
] [
rot traits-map [ put ] bind
] ifte ;
: M: ( -- type generic [ ] ) : M: ( -- type generic [ ] )
#! M: foo bar begins a definition of the bar generic word #! M: foo bar begins a definition of the bar generic word
#! specialized to the foo type. #! specialized to the foo type.
scan-word scan-word [ rot traits-map [ put ] bind ] [ ] ; scan-word scan-word [ (;M) ] [ ] ;
parsing parsing