Scope of variables

bearophile bearophileHUGS at lycos.com
Sat Jun 25 16:36:49 PDT 2011


Jonathan M Davis:

> The situation in D with regards to variable names isn't really any more 
> complex in D than it is in C++,

I don't agree. In D I use many inner functions, so I have to be careful about where a variable is defined, if global, if local, or if local in the outer function. This burns some of my time.


> and in my experience it's virtually never a 
> problem in C++. Smart variable naming makes things clear. This is a complete 
> non-issue IMHO. It rarely creates bugs.

Seeing my recurring mild troubles, and how SPARK has chosen a more strict attitude, I think you are not fully right.


> Non offense, but honestly, if you're 
> seeing much in the way of bugs from using the wrong variable, I have to wonder 
> if you're doing something wrong.

None taken, you're one of the most polite and gentle persons around here, I appreciate this.

Surely different programmers have different cognitive capabilities. Sometimes in CLisp I get lost in parentheses, while I usually know where the North is while I program in Haskell.

There's lot of free space to explore while you design a programming language, and I think current languages usually have parts that can be improved.

Designing good computer languages is one of the most difficult activities I see around, they are interfaces between quirky and very complex mammals and refined and increasingly complex tech agglomerates able to approximate universal computation machines.

Bye,
bearophile


More information about the Digitalmars-d mailing list