Contents | < Browse | Browse >
4M. pointer typing (::)
when you write an expression like 'p' where p is a PTR TO object
(and only objects), this allows you to dereference it as such.
The pointer typing operator allows you to change such a type on the fly:
DEF p:PTR TO mp -> message port
p.sigbit -> access it
p::ln.name -> access pointer as if it were a node
this is very useful for pointers that can point to different sorts
of things or objects that are part of each other, where of course
only one declaration is possible.
A second handy use is in OBJECTs that have members declared as LONG,
which are actually pointers. You may type it on the fly to dereference
here the window OBJECT has userport defined as LONG, so you wouldn't
be able to dereference it normally.