From 11e98d9fd4ecd32d5565a73f1b3efe168cb1b333 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 11 Dec 2004 23:27:02 +0000 Subject: [PATCH] more generic work --- library/generic.factor | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/library/generic.factor b/library/generic.factor index c12dd31f0d..3c625e705c 100644 --- a/library/generic.factor +++ b/library/generic.factor @@ -145,8 +145,17 @@ SYMBOL: delegate #! traits type. 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: foo bar begins a definition of the bar generic word #! specialized to the foo type. - scan-word scan-word [ rot traits-map [ put ] bind ] [ ] ; + scan-word scan-word [ (;M) ] [ ] ; parsing