reflection: Reflection operations
- GetMember(instance, id)
- Return a member of an instance. The id argument must be a
Str object. Raise MemberError if the member is
not defined. Example:
var range = 2 to 5 GetMember(range, "start") -- 2
- SetMember(instance, id, value)
- Set the value of a member of an instance. The id argument must be a Str object. Raise MemberError if the member is not defined or if it is a method or a constant.
- HasMember(instance, id)
- Return a boolean indicating whether an instance has a specific member. The id argument must be a Str object.
- TypeOf(instance)
- Return a type object representing the class of the argument.
TypeOf works for all values except nil;
if the argument is nil, raise a ValueError exception.
The returned object is a type object bound to the relevant class
definition. Examples:
TypeOf(1) -- std::Int TypeOf([1, 2]) -- std::Array