|
|
Language |
|
|
What are CONST parameters? What are they good for?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. PROCEDURE Length (CONST string: ARRAY OF CHAR): LONGINT;
As the interface of the procedure ASSERT (Length ("Hello") = 5);
What are module contexts? How are they used?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 like in this sample module: MODULE Test IN Oberon;
Please note that if the context of an imported module is not explicitly specified (like e.g. for Streams), it defaults to the context of the module (Oberon in this case). 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 For more information about contexts, please refer to this document. |
|
Copyright © 2007 ETH Zürich
|
Page last modified on June 25, 2008, at 05:32 PM
|