]> gitweb.factorcode.org Git - factor.git/blob - core/generic/standard-combination.facts
more sql changes
[factor.git] / core / generic / standard-combination.facts
1 USING: generic help sequences ;
2
3 HELP: no-method
4 { $values { "object" "an object" } { "generic" "a generic word" } }
5 { $description "Throws a " { $link no-method } " error." }
6 { $error-description "Thrown by the " { $snippet "generic" } " word to indicate it does not have a method for the class of " { $snippet "object" } "." } ;
7
8 HELP: standard-combination
9 { $values { "word" "a generic word" } { "dispatch#" "a dispatch position" } { "quot" "a new quotation" } }
10 { $description
11     "Performs standard method combination."
12     $terpri
13     "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. If no suitable method is defined on the class of the dispatch object, the generic word is called on the dispatch object's delegate. If the delegate is " { $link f } ", an exception is thrown."
14 }
15 { $examples
16     "A generic word for append strings and characters to a sequence, dispatching on the object underneath the top of the stack:"
17     { $code
18         "G: build-string 1 standard-combination ;"
19         "M: string build-string swap nappend ;"
20         "M: integer build-string push ;"
21     }
22 }
23 { $notes "The " { $link POSTPONE: GENERIC: } " parsing word defines generic words using the standard method combination with dispatch position 0." }
24 { $examples "Most generic words in the standard library use this method combination with a dispatch position of 0. A handful of combinators such as " { $link each } " dispatch on position 1, since position 0 (the top of the stack) is a quotation." }
25 { $see-also POSTPONE: GENERIC: define-generic POSTPONE: G: define-generic* } ;
26
27 HELP: define-generic
28 { $values { "word" "a word" } }
29 { $description "Defines a generic word with the " { $link standard-combination } " method combination, and a dispatch position of 0." }
30 { $see-also POSTPONE: GENERIC: define-generic* } ;