]> gitweb.factorcode.org Git - factor.git/commitdiff
clean up docs
authorAlex Maestas <git@se30.xyz>
Wed, 22 Mar 2023 00:02:26 +0000 (00:02 +0000)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 21 Aug 2023 21:28:15 +0000 (14:28 -0700)
basis/delegate/delegate-docs.factor
core/generic/generic-docs.factor

index cd7e4049ff6d14eb7a3116f27e0f85a67e788c64..8d1ab5675aaa1817d0336fc5757620338baff1d3 100644 (file)
@@ -21,7 +21,10 @@ HELP: CONSULT:
 { $syntax "CONSULT: group class
     code ;" }
 { $values { "group" "a protocol, generic word or tuple class" } { "class" "a class" } { "code" "code to get the object to which the method should be forwarded" } }
-{ $description "Declares that objects of " { $snippet "class" } " will delegate the generic words contained in " { $snippet "group" } " to the object returned by executing " { $snippet "code" } " with the original object as an input. " { $snippet "CONSULT:" } " will overwrite any existing methods on " { $snippet "class" } " for the members of " { $snippet "group" } ", but new methods can be added after the " { $snippet "CONSULT:" } " to override the delegation. Currently, this is only supported for " { $snippet "standard-combination" } " and " { $snippet "hook-combination" } " generics." } ;
+{ $description "Declares that objects of " { $snippet "class" } " will delegate the generic words contained in " { $snippet "group" } " to the object returned by executing " { $snippet "code" } " with the original object as an input. " { $snippet "CONSULT:" } " will overwrite any existing methods on " { $snippet "class" } " for the members of " { $snippet "group" } ", but new methods can be added after the " { $snippet "CONSULT:" } " to override the delegation. Currently, this is only supported for " { $snippet "standard-combination" } " and " { $snippet "hook-combination" } " generics." }
+{ $heading "Example" }
+"The following code creates an " { $snippet "example-theme" } " that makes the status bar text green instead of white, and delegates all other " { $snippet "theme-protocol" } " words to " { $snippet "dark-theme" } "." $nl
+{ $code "USING: delegate ui.theme ;" "" "SINGLETON: example-theme" "CONSULT: theme-protocol example-theme dark-theme ;" "" "M: example-theme status-bar-foreground COLOR: green ;" } ;
 
 HELP: BROADCAST:
 { $syntax "BROADCAST: group class
index d31ded6bc38afe89199da9864bf21cb138f274b7..19032ffe721fada9b3a7e52edb6732af6f621717 100644 (file)
@@ -201,4 +201,4 @@ HELP: make-consult-quot
 { $contract "This generic produces the body quotation that will be used to actually effect a method consultation from the " { $vocab-link "delegate" } "vocabulary." }
 { $notes "This is already implemented for " { $snippet "standard-combination" } " and " { $snippet "hook-combination" } ", and thus only needs to be specialized if you are implementing " { $snippet "CONSULT:" } " for a different kind of combination." }
 { $heading "Reasoning" }
-"For standard method combinations, this calls the quotation to obtain the consulted object, and then executes the generic word, which naturally dispatches against the object on the stack. This is not sufficient for hook combinations, which must have the generic word executed with a variable bound to the result of the quotation. This generic is what allows for specializing the behavior of the methods that " { $snippet "CONSULT:" } "creates." ;
+"For standard method combinations, this calls the quotation to obtain the consulted object, and then executes the generic word, which naturally dispatches against the object on the stack. This is not sufficient for hook combinations, which must have the generic word executed with a variable bound to the result of the quotation. This generic is what allows for specializing the behavior of the methods that " { $snippet "CONSULT:" } " creates." ;