![]() |
Examples 8.15.1.2: |
The features of the required library class SYS are used in individual examples. None of the examples given is a complete class nor necessarily a 'complete' method.
Since Sather implementatioins are required to be garbage collected, it is not strictly necessary to explicitly discard objects which have been finished with. There are occasions where some object has merely been used temporarily in some method, will not be used again and could therefore be collected. This routine is provided to offer a hint ti a garbage collector which, since the garbage collector is not part of the Sather implementation, it may take or ignore at will, thus -
is all that is needed to provide the hint!
This predicate is provided to fill the gap for an object class which does not provide its own equality routine. This routine, however, does not test for equality of value, rather it tests that two objects are the same (in some implementation-defined way).
This predicate is provided to fill the gap for an object class which does not provide its own is_lt routine. This routine, however, does not test for ordering of value, rather that the two objects themselves are ordered in some implementation-defined way.
This routine provides a hash value based on the identity of the object rather than its value, thus
>provides a value which may be used when inserting objects into maps or sets, dependent on how they may be implemented.
The notion of a unique identity for an object is very useful when interacting with some call-back mechanism and needing to despatch to the appropriate object based upon some value (the id!) returned by the external environment (eg a window manager). This all depends on whether the window manager provides the 'handle' or the Sather program. A call such as
always yields a unique object identity token.
This feature corresponds to the id one above; this, however, provides a unique reference to the actual type of the object concerned, thus -
NOTE | It is very important to remember that a bit-pattern forming a reference to a type might be identical to some other bit-pattern which is a reference to an object, or to some environmental reference, etc. It is the programmer's responsibility to avoid using the wrong reference in the right place! |
This feature is provided for use when preparing messages which need to refer to the type of some object in text string form, thus a type string could readily be produced by combining the 'tp' feature with this, to produce
for use in message preparation as necessary. It should be noted that this message will be provided in the current repertoire and encoding. Any need toproduce the message in some other form will need to use the code conversion facilities in the Code section of this library.
This feature is needed by the internationalisation section of this library when finding resources for the default local culture (not the international default culture!). Thus, for an object of type LIBCHARS, the call
will produce (in the encoding of the class UNICODE) the word "LIBCHARS".
![]() |
Specification Index | ![]() |
Language Index | ![]() |
Section 8 Index |
Comments
or enquiries should be made to Keith Hopper. Page last modified: Sunday, 21 May 2000. |
![]() |