![]() |
Section 8.15.1.1:
|
![]() |
types SAME = REFERENCE ; REFERENCE = token
Instances of this class are references to external objects. An implementation may provide this facility in the most convenient way since it is opaque to the using program.
This feature is provided for use in those cases where it is known by the program writer that some external reference is a numeric value, in order to maintain the integrity of the class type safeness of the language.
create_from_value | ( |
val : $IMMUTABLE | |
) : SAME |
create_from_value(val : $IMMUTABLE) res : SAME
pre is_immutable(val)
This routine converts the value object provided as argument into a reference which is meaningful to the execution environment. The exact form of this is implementation-dependent.
NOTE | The pre-condition is established so that the implementation can indicate that some particular object type or value cannot be converted into a reference. |
This feature provides a mechanism to convert an object into a reference to it suitable for use in external environment service calls.
create_from_object | ( |
obj : $OB | |
) : SAME |
create_from_object(obj : $OB) res : SAME
pre not is_immutable(obj)
This routine converts the reference object provided as argument into a reference to it which is meaningful to the execution environment. The exact form of this is implementation-dependent.
NOTE | The pre-condition is established so that the implementation can indicate that some particular object type cannot be converted into a reference. |
This feature creates a reference from a 'foreign' object - ie one defined using the external class mechanism with a named 'foreign' form (ie not being the external class kind 'OS'.
create_from_foreign | ( |
obj : $OB | |
) : SAME |
create_from_object(obj : $OB) res : SAME
This routine treats the object provided as argument as a reference which is meaningful to the execution environment. The exact form of this is implementation-dependent.
This feature is provided as an implementation-dependent predicate to indicate if the object which is its argument is immutable in the sense understood by the underlying execution environment.
is_immutable | ( |
obj : $OB | |
) : BOOL |
is_immutable(obj : $OB) res : BOOL
Note that the set of immutable objects is specified in section 6.9. The set immutables will normally be the set of all concrete classes which sub-type either directly or indirectly from the abstract class $IMMUTABLE.
post res = type_of(obj) in set immutables
This predicate returns true if and only if obj is an immutable object suitable for converting into a reference.
This feature is one of two which perform implementation-dependent object creation from an external reference.
make_object1(self : SAME) res : [$OB]
post res = nil or create_from_object(res) = self
This routine returns a Sather object for which self is a handle and for which the implementation can determine the type from the context in which it is called. If self is not valid then void is returned.
This second make_object feature is provided for making an object the type of which, though not the size, is known when translating the class; the size being known only at run-time.
make_object | ( |
size : CARD | |
) : $OB |
make_object2(self : SAME, size : CARD) res : $OB
presize > 0
post res = nil or create_from_object(res) = self
This routine returns a Sather object for which self is a handle and for which the implementation can determine the type (but not the size - which is only known at run-time and is the argument to this routine) from the context in which it is called. If self is not valid then void is returned.
This feature converts the reference into a cardinal number. Whther or not this is semantically meaningful must be decided by the programmer - as the language definition cannot do so.
card(self : SAME) res : CARD
post create_from_value(res) = self
This routine returns the cardinal number expressed by the reference bit_pattern.
This feature provides the facility to convert the reference into an integer value where this is meaningful within the program. This cannot be specified in the language.
int(self : SAME) res : INT
post create_from_value(res) = self
This routine returns the possibly signed integer number expressed by the reference bit_pattern for use where low-level objects may either be a number or a reference.
![]() |
Language Index | ![]() |
Library Index | ![]() |
Sather RT Index |
Comments
or enquiries should be made toKeith Hopper. Page last modified: Wednesday, 4 April 2001. |
![]() |