C:
Factor handbook » The language » Objects » Tuples » Tuple constructors

Prev:boa ( slots... class -- tuple )
Next:Parameterized constructors


Vocabulary
syntax

Syntax
C: constructor class


Inputs
None

Outputs
None

Word description
Define a constructor word for a tuple class which simply performs BOA (by order of arguments) construction using boa.

Examples
Suppose the following tuple has been defined:
TUPLE: color red green blue ;

The following two lines are equivalent:
C: <color> color : <color> ( red green blue -- color ) color boa ;

In both cases, a word <color> is defined, which reads three values from the stack and creates a color instance having these values in the red, green and blue slots, respectively.

Definition