CONST parameters are treated like variable (VAR) parameters except that you are not allowed to change their actual values. Arguments are therefore passed by reference and there is no need to copy them on the stack. This is primarily useful to pass arrays of arbitrary length, but especially arrays of characters. CONST allows the caller to pass arrays more efficiently (in time and space) and guarantees at the same time, that the array won't be modified by the callee.
Consider the following example where copying the string does not make much sense but was actually necessary before we introduced CONST parameters.
As the interface of the procedure
Module contexts are single-level namespaces that allow modules with the same name to co-exist at the same time. They were introduced to clearly separate modules belonging to Oberon and A2 (previously Aos). Therefore there are currently two contexts defined: A2 and Oberon, whereas A2 is the default one.
Modules intended to be run within the Oberon system have to belong to the Oberon context. This is specified by code as in this sample module:
If the context of an imported module is not explicitly specified as for Streams, it defaults to the context of the module, which is Oberon in this example.
Following the naming conventions established since revision 1319 for all Oberon modules, the filename of this example should be prefixed by Oberon and reads therefore
The original pdf document has more information.
Copyright © 2007 ETH Zürich
Page last modified on September 19, 2013, at 03:51 PM