[Issue 19056] UDAs can be added to imports but not retrieved

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 8 10:48:01 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19056

Smaulder <smauldersauce at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smauldersauce at gmail.com

--- Comment #2 from Smaulder <smauldersauce at gmail.com> ---
> In my opinion, the best solution would be to make adding UDAs to aliases illegal and also not allow UDAs to imports as long as imports create aliases behind the scenes.

I disagree, this would cause a lot of breaking changes. It will make it
difficult to write code that would otherwise be simple.

Attributes are allowed to be applied to aliases even if it does nothing is for
simplicity.

    enum value = 10;

    struct Foo
    {
    @nogc:
        alias bar = value; // should be an error to allow "@nogc:"
                           // to apply to whole scope for simplicity
    }


Just as some attributes can be applied to symbols that do not do anything:

    @nogc int variable; // Still allowed, doesn't do anything

--


More information about the Digitalmars-d-bugs mailing list