[Oberon] SystemV- Heap + Module Space

Chris Burrows chris at cfbsoftware.com
Sat Jan 5 12:37:37 CET 2019


> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Richard Hable
> Sent: Saturday, 5 January 2019 6:31 PM
> To: oberon at lists.inf.ethz.ch
> Subject: Re: [Oberon] SystemV- Heap + Module Space
> 
> On 04.01.19 23:33, J rg wrote:
> 
> > Instead of adding a comment        IF res = 3 THEN (* corrupted
> file *) ... END;
> > a constant could help                      IF res = corruptFile
> THEN ... END;
> 
> Actually, both lines are readable, but the first line gives more
> information: as soon as you start debugging even if it s just with a
> simple write statement, you will want to know what the value 3 in res
> actually means.
> 

The problem with comments is that they are unreliable. It is so easy to change one instance but forget to change other related instances. E.g. in this particular case in Modules.Mod:

1.    PROCEDURE Load*(name: ARRAY OF CHAR; VAR newmod: Module);
      (*search module in list; if not found, load module.
      res = 0: already present or loaded; res = 2: file not available; res = 3: key conflict;
      res = 4: bad file version; res = 5: corrupted file; res = 7: no space*) 


2.   IF ch # "O" THEN (*corrupted file*)  mod := NIL; error(4, name) END   

Which comment is the correct one? 

Incorrect / misleading comments are worse than no comments at all.

Regards,
Chris

Chris Burrows
CFB Software
http://www.astrobe.com




More information about the Oberon mailing list