What Does @ Mean?

Ron Tarrant rontarrant at gmail.com
Mon Apr 8 14:31:31 UTC 2019


On Monday, 8 April 2019 at 14:19:04 UTC, XavierAP wrote:
> On Monday, 8 April 2019 at 11:58:49 UTC, Ron Tarrant wrote:
>>
>> And while I'm asking, does an underscore have special meaning 
>> when used either at the beginning or end of a variable name?
>
> In D, @ is used as Adam has explained as a prefix indicating 
> attributes (either user-defined ones or, confusingly enough, 
> some of the standard ones).

Yup. Confusion. Yup. :)

> Of course you should never do this unless you absolutely need 
> for interop.

No fear of that. I was just trying to understand the example I 
cited.

> For example in D you could have a public property length and a 
> private member _length.

This seems like a good practice.

> In this case I've seen some other annoying conventions, for 
> example private member variables being prefixed with m_

The things I missed by not getting my degree... or by not keeping 
my nose to the grindstone for the last 30-odd years. :)

Thanks, Xavier.


More information about the Digitalmars-d-learn mailing list