Category talk:Wren-trait: Difference between revisions
→Source code: Added ByRef class.
(→Source code: Added two more methods to Stepped class.) |
(→Source code: Added ByRef class.) |
||
Line 111:
iteratorValue(iterator) { _seq.iteratorValue(iterator) }
}
/* ByRef wraps a value to enable it to be passed by reference to a method or function. */
class ByRef {
// Constructs a new ByRef object.
construct new(value) {
_value = value
}
// Properties to get and set the value of the current instance.
value { _value }
value=(v) { _value = v }
// Returns the string representation of the current instance's value.
toString { _value.toString }
}
Line 118 ⟶ 133:
var Trait_Comparable = Comparable
var Trait_Stepped = Stepped
var Trait_Reversed = Reversed
var Trait_ByRef = ByRef</lang>
|