On Sat, Jan 5, 2013 at 11:14 PM, Walter Bright <newshound2@digitalmars.com> wrote:
On 1/5/2013 2:06 PM, Philippe Sigaud wrote:
But why is @(MyType) accepted, whereas @(int) is not?

Because it's looking for an expression inside the parents, and int is not an expression.


Well, first that would be nice to have the grammar online :)

Even if I understand the grammar restriction, from a user PoV this is quite unexpected: a built-in type is a completely legal part of a D tuple. Either it should be restricted to user-defined types (something I don't like), or, if attributes are supposed to be tuples, then any tuple element should be authorized.

And I will not buy a possible argument saying that I can wrap an int inside a user-defined type. Yes, I can. But then, there is the same solution for @(3) or @("Hello") and *these* are legal.