|
| ||||||||||||
See also: make
make method to easily copy down all the data
fields of the class into the instance. It returns the modified _subject
Data fields are fields whose value is not a method or a class.
<class foo x=5>
<method make>
.<copy_down_data/>
</>
</class>
<foo/>.<get "x"/>![]() | 5 |
foo.<set x=99/> will not be seen by the foo instances since they
now shadow the value in their parent.
Note this is similar to many class-instance object systems wherein the instances
always have their own copies of the instance variables.
In Water, if an instance doesn't have a variable it looks up into its parent
to get the value.
If no field keys are explicitly given,
only the field keys in _field_order of the parent are copied down.
Fields that already exist in the subject are not copied down.
To explicitly copy_down a field, give the field keys as arguments.
<class foo x=5 y=true z=integer>
<method make>
.<copy_down_data "z"/>
</>
<method bar/>
</class>
<foo y=10/>![]() | <foo x=5 y=10 z=number.integer/> |
© Copyright 2007 Clear Methods, Inc.