]> gitweb.factorcode.org Git - factor.git/blob - core/generic/standard/standard-docs.factor
factor: Rename GENERIC# to GENERIC#:.
[factor.git] / core / generic / standard / standard-docs.factor
1 USING: effects generic.single help.markup help.syntax words ;
2 IN: generic.standard
3
4 HELP: standard-combination
5 { $class-description
6     "Performs standard method combination."
7     $nl
8     "Generic words using the standard method combination dispatch on the class of the object at the given stack position, where 0 is the top of the stack, 1 is the object underneath, and 2 is the next one under that. A " { $link no-method } " error is thrown if no suitable method is defined on the class."
9 }
10 { $examples
11     "A generic word for append strings and characters to a sequence, dispatching on the object underneath the top of the stack:"
12     { $code
13         "GENERIC#: build-string 1 ( elt str -- )"
14         "M: string build-string swap push-all ;"
15         "M: integer build-string push ;"
16     }
17 } ;
18
19 HELP: define-simple-generic
20 { $values { "word" word } { "effect" effect } }
21 { $description "Defines a generic word with the " { $link standard-combination } " method combination and a dispatch position of 0." } ;