Module level variable shadowing

Ary Borenszweig via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 28 05:20:14 PDT 2014


On 6/28/14, 6:30 AM, Jacob Carlborg wrote:
> On 2014-06-28 08:19, dennis luehring wrote:
>
>> thx for the examples - never though of these problems
>>
>> i personaly would just forbid any shadowing and single-self-assign
>> and then having unique names (i use m_ for members and p_ for parameters
>> etc.) or give a compile error asking for this.x or .x (maybe problematic
>> with inner structs/functions)
>
> I think, in general, if you need to prefix/suffix any symbols name,
> there's something wrong with the language.

In Ruby the usage of a variable is always prefixed: `@foo` for instance 
vars, `$foo` for global variable, `FOO` for constant. You can't make a 
mistake. It's... perfect :-)



More information about the Digitalmars-d mailing list