How can we make it easier to experiment with the compiler

sighoya sighoya at gmail.com
Tue May 25 08:32:46 UTC 2021


On Tuesday, 25 May 2021 at 04:21:08 UTC, Ola Fosheim Grostad 
wrote:

> This is not helpful. Too much commenting makes the code even 
> harder to read and drowns out important comments.  This 
> corporate illness (which assumes that programmers are idiots) 
> is why editors now ship with hide-all-comments functionality... 
> Good code with good naming needs only few comments and those 
> are on an _algorithmic_ level.

You can't encode the full semantic into one function name with 
parameter names without to over blow these names.
Though, I concur with you for better naming, at least no 
abbreviations.
I even find the code to be more structured with comment blocks, 
in my eyes it aids to visualize the code structure better.


> Nobody that has read an introductory book on compilers need a 
> comment explaining a function that is looking up a symbol from 
> a symboltable. If that is a problem, improve the name, use a 
> longer name.

+1 for `Symbol lookUpSymbol(string symbolName)`

However, small comments inside the function would also be 
beneficial.
A good example of comments is the ast module of nim:

https://github.com/nim-lang/Nim/blob/devel/compiler/ast.nim


More information about the Digitalmars-d mailing list