On Wednesday, 7 November 2012 at 09:23:44 UTC, Jonathan M Davis wrote:
On Wednesday, November 07, 2012 10:13:47 Jonas Drewsen wrote:
My vote goes to @(a,b,c) and @a @b @c.

I never understood why some builtin storage class keywords have @ in front of them (e.g. @property, @safe, @disable) and some don't
(e.g. pure, nothrow).

IMHO the cleanest design would be to have builtins as plain
keywords (ie. no @ in front). And then @xxx is reserved for UDA.

I understand that this would be a breaking change and not likely
to happen - just want to know the reasoning behind it.

It mainly came down to not wanting to add new keywords. By using @safe instead of safe, safe could still be used as a variable or function or whatnot. There was some discussion of which should have @ on them on which not (e.g. nothrow vs @nothrow was debated), but the decision was fairly arbitrary. If anything though, had we not cared about breaking code or whether D looked similar to other languages, we probably would have made _all_ attributes start with @ (including stuff like @public). It would have been wonderfully consistent that
way, but it wasn't ultimately deemed a good idea.

So, basically, @ was introduced to avoid adding more keywords. It certainly makes sense to extend it for using with user defined attributes, but that
wasn't really the original intention.

- Jonathan M Davis

I we were to allow for @foobar style UDA then "safe" would have to be a reserved keyword somehow. Otherwise I do not know what this would mean:

struct safe { }
@safe void foobar() { }

/Jonas


Reply via email to