[Oberon] SystemV- Heap + Module Space

Jörg joerg.straube at iaeth.ch
Thu Jan 3 17:35:43 CET 2019


Wojtek

There are comments in the code defining the error values. But you are right, constants would have been cleaner. They can be declared locally and exported. 

CONST
  fileNotAvail* = 1;
  badFileVersion* = 2;
  keyConflict* = 3;
  fileCorrupt* = 4;
  noSpace* = 7;

Instead of this
    IF ch # "O" THEN (*corrupted file*) mod := NIL; error(4, name) END
you then write this
    IF ch # "O" THEN mod := NIL; error(fileCorrupt, name) END

br, Jörg

> Am 03.01.2019 um 17:17 schrieb Skulski, Wojciech <skulski at pas.rochester.edu>:
> 
> Tomas:
> 
> I thought that a robust programming style would use named constants defined in one "include" file. Would be an import in case of Oberon.
> 
> IMPORT ErrorCodes;
> ....
> ELSIF res = ErrorCodes.MODULE_LOAD_FAILURE THEN importing := name;
> 
> Or perhaps define the codes in the same module, if they are local:
> 
> CONST MODULE_LOAD_FAILURE = 3; (*defined at the top of the same module*)
> 
> Looking at "ELSIF res = 3" I start wondering about C programming culture. Are those guys crazy when they insist on named constants?
> 
> Wojtek
> ------------------------------------
> Tomas wrote:
>> ELSIF res = 3 THEN importing := name;
>>          WHILE nofimps > 0 DO DEC(nofimps);
>> DEC(import[nofimps].refcnt) END
> 
> Aha, changing it to
> ELSIF (res = 3) OR (res = 7) THEN ...
> 
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon



More information about the Oberon mailing list