Proposal: user defined attributes
Steven Schveighoffer
schveiguy at yahoo.com
Fri Mar 16 11:07:17 PDT 2012
On Fri, 16 Mar 2012 13:36:42 -0400, Adam D. Ruppe
<destructionator at gmail.com> wrote:
> On Friday, 16 March 2012 at 16:57:26 UTC, Steven Schveighoffer wrote:
>> I thought @<symbol> was supposed to be a user-defined annotation.
>> Otherwise, why did we introduce @syntax?
>
> idk, to "reduce" the number of keywords or somethiny.
Quote from TDPL (section 5.9.1 on page 156):
"Attributes, always introduced with @, are simple adornments specifying
certain features for the symbol being defined. Some attributes are
recognized by the compiler; some are defined and used by the programmer
alone."
I assumed this was true, and thought so even before TDPL came out. See
http://prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP6
> This is why I call it a mistake or missed opportunity
> right now though: @property, @safe, @disable, @system,
> and @trusted have already made a claim on the @syntax.
I think those are just compiler-defined attributes. They aren't keywords
in the sense that the parser doesn't treat them as special. They are just
another type of symbol.
> I could live with that too, but I think it'd be harder
> to make happen due to potential clashes with the current
> thing @ is used for.
meh, just don't use @safe, @property, @disable, @system, and @trusted. I
don't see a huge number of compiler-defined attributes springing up. Nor
do I see a huge number of library or user-defined ones springing up.
-Steve
More information about the Digitalmars-d
mailing list