diff --git a/core/generic/multi/multi.factor b/core/generic/multi/multi.factor index 7608284b711..2d1e43187e9 100644 --- a/core/generic/multi/multi.factor +++ b/core/generic/multi/multi.factor @@ -1,8 +1,8 @@ USING: accessors arrays assocs classes classes.algebra classes.algebra.private -classes.private combinators definitions effects effects.parser generalizations -generic generic.parser generic.single generic.single.private generic.standard -kernel make math math.order namespaces parser quotations sequences sets sorting -vectors words ; +classes.private combinators definitions effects effects.parser fry +generalizations generic generic.parser generic.single generic.single.private +generic.standard kernel make math math.order namespaces parser +prettyprint.custom quotations sequences sets sorting vectors words ; IN: generic.multi @@ -295,3 +295,21 @@ ERROR: empty-dispatch-spec seq ; ] with-definition ; SYNTAX: MM: (MM:) define ; + +! * Literal syntax for dispatch specifiers + +! Currently only covariant-tuple. For the moment just some convenience to +! identify and print multi-methods using the existing single method code with +! something like M\ D{ class1 class2 } generic +! But defining with M: D{ class1 class2 } generic ... ; does not turn the generic +! into a multi-generic ! + +SYNTAX: D{ + \ } [ ] parse-literal ; + +M: covariant-tuple pprint* pprint-object ; + +M: covariant-tuple pprint-delims + drop \ D{ \ } ; + +M: covariant-tuple >pprint-sequence classes>> ; diff --git a/core/syntax/syntax.factor b/core/syntax/syntax.factor index a2d48456a2e..a112664b099 100644 --- a/core/syntax/syntax.factor +++ b/core/syntax/syntax.factor @@ -112,7 +112,7 @@ IN: bootstrap.syntax "POSTPONE:" [ scan-word suffix! ] define-core-syntax "\\" [ scan-word suffix! ] define-core-syntax - "M\\" [ scan-word scan-word lookup-method suffix! ] define-core-syntax + "M\\" [ scan-class scan-word lookup-method suffix! ] define-core-syntax "inline" [ last-word make-inline ] define-core-syntax "recursive" [ last-word make-recursive ] define-core-syntax "foldable" [ last-word make-foldable ] define-core-syntax