Module level variable shadowing

dennis luehring via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 28 07:52:34 PDT 2014


Am 28.06.2014 14:20, schrieb Ary Borenszweig:
> 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 :-)
>

i like the ruby-way


More information about the Digitalmars-d mailing list