[Issue 22565] Attributes not accepted for empty declaration
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Dec 9 09:27:29 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=22565
--- Comment #5 from RazvanN <razvan.nitu1305 at gmail.com> ---
(In reply to Răzvan Ștefănescu from comment #4)
> UDAs can be attached to any declaration according to the grammar, not to a
> symbol only.
>
> How useful is that, it's debatable, but there are situations where the fact
> that attributes are attached to declarations, not to a symbol makes a huge
> difference:
>
> @attr
> int a, b, c;
>
> where @attr is applied to a, b and c, not to a only.
>
Yes, but the point is that @attr is applied individually to each of the
variable declarations.
> Also there is the unittest case where there is no symbol, but attributes can
> have a meaning and can be obtained using __traits, see
> https://dlang.org/spec/traits.html#getUnitTests
>
Unittests appear to not have a name, but they are actually not any different
from any other function (internally, the compiler assigns a name of the form
`__unittest_$generate_some_number`).
> There are two options:
> - dmd must eat his own food by implementing the existing grammar
> specification or,
> - the grammar must be adjusted to match the current situation;
>
I would opt for the later.
> Tizule, iute ești mă la mânie, ia-o mai ușor :)
:))
--
More information about the Digitalmars-d-bugs
mailing list