2.5.24. Struct

TODO.

2.5.24.1. Instruction

target = struct.get op1 op2 [struct_::Get]
Target:any
Operator 1:ref<struct { } >
Operator 2:string

Returns the field named op2 in the struct referenced by op1. The field name must be a constant, and the type of the target must match the field’s type. If a field is requested that has not been set, its default value is returned if it has any defined. If it has not, an UndefinedValue exception is raised.

target = struct.get_default op1 op2 op3 [struct_::GetDefault]
Target:any
Operator 1:ref<struct { } >
Operator 2:string
Operator 3:any

Returns the field named op2 in the struct referenced by op1, or a default value op3 if not set (if the field has a default itself, that however has priority). The field name must be a constant, and the type of the target must match the field’s type, as must that of the default value.

target = struct.is_set op1 op2 [struct_::IsSet]
Target:bool
Operator 1:ref<struct { } >
Operator 2:string

Returns True if the field named op2 has been set to a value, and False otherwise. If the instruction returns *True, a subsequent call to ~~Get will not raise an exception.

struct.set op1 op2 op3 [struct_::Set]
Operator 1:ref<struct { } >
Operator 2:string
Operator 3:any

Sets the field named op2 in the struct referenced by op1 to the value op3. The type of the op3 must match the type of the field.

struct.unset op1 op2 [struct_::Unset]
Operator 1:ref<struct { } >
Operator 2:string

Unsets the field named op2 in the struct referenced by op1. An unset field appears just as if it had never been assigned an value; in particular, it will be reset to its default value if has been one assigned.