Why do some language-defined attributes have @ and some not?
Jonathan M Davis via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Oct 22 12:25:51 PDT 2014
On Wednesday, 22 October 2014 at 19:13:58 UTC, Shriramana Sharma
via Digitalmars-d-learn wrote:
> Hello. See http://dlang.org/attribute. 3 attributes starting at
> http://dlang.org/attribute#disable have a @ in front.
> Apparently safe,
> trusted and system also do, though these are documented
> elsewhere:
> http://dlang.org/function.html#function-safety.
>
> Why are some language-defined attributes starting with @ and
> others
> not? Wouldn't it be consistent and less-confusing to, say, only
> use @
> for user-defined attributes and not these language-defined ones?
It's a historical thing. Walter didn't want to add more keywords,
so we put @ in the front of some of the new ones. User-defined
attributes didn't even exist at the time. Those were added far
later. It would be nice if none of the built-in attributes had @
on them, but it's far too late now. And by the way, there's also
@property, so there's four of them with @.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list