CONSULT:
Factor handbook » The language » Objects » Delegation

Prev:BROADCAST:
Next:define-consult ( consultation -- )


Vocabulary
delegate

Syntax
CONSULT: group class code ;


Inputs
None

Outputs
None

Word description
Declares that objects of class will delegate the generic words contained in group to the object returned by executing code with the original object as an input. CONSULT: will overwrite any existing methods on class for the members of group, but new methods can be added after the CONSULT: to override the delegation. Currently, this is only supported for standard-combination and hook-combination generics.

Example
The following code creates an example-theme that makes the status bar text green instead of white, and delegates all other theme-protocol words to dark-theme.

USING: delegate ui.theme ; SINGLETON: example-theme CONSULT: theme-protocol example-theme dark-theme ; M: example-theme status-bar-foreground COLOR: green ;


See also
define-consult, BROADCAST:

Definition