[Issue 3858] mixin attribute is ignored

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 15 14:01:13 UTC 2021


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

Adam D. Ruppe <destructionator at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |destructionator at gmail.com
         Resolution|---                         |INVALID

--- Comment #4 from Adam D. Ruppe <destructionator at gmail.com> ---
I'm gonna go ahead and close this because it isn't really a bug.

mixins always work on complete AST nodes. They don't paste in code that
modifies future things, it is all self-contained.

So you should think of the mixin stuff to be wrapped in {}. Sort of, obviously
that's not always literally true but it illustrates the scope limitation.

So mixin("private:") is like mixin("{private:}").

that is, it does exactly what it is supposed to do: apply private to the end of
the current declaration block... but the current declaration block inside the
mixin ends where the mixin ends. Meaning it is just a do-nothing thing, which
is perfectly legal!

--


More information about the Digitalmars-d-bugs mailing list