Thread overview
[Issue 20053] add mixin types
[Issue 20053] mixin doesn't work for many expressions
Jul 16
Basile-z
Jul 23
Manu
Jul 24
Dlang Bot
Jul 29
Dlang Bot
July 16
https://issues.dlang.org/show_bug.cgi?id=20053

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp@gmx.com

--- Comment #1 from Basile-z <b2.temp@gmx.com> ---
Attempt : https://github.com/Basile-z/dmd/pull/3

But there are problems. The MixinExpression takes expressions as argument but among the stuff that are supposed to be aliased there are not only expressions, only types that look like expressions work. Concretely

A simple thing like

  alias A1 = mixin("int");

Does not work and instead

  alias Int = int;
  alias A1 = mixin("Int");

must be used.

Otherwise the change is really simple (current work is less than an hour) so I
may propose it anyway.

--
July 23
https://issues.dlang.org/show_bug.cgi?id=20053

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
> Lots of expressions don't work as mixin

They do. Compile mixins come in three forms:

1. declaration
2. statement
3. expression

The form they don't come in is as a type, which is what your example requires.

Also:

    alias E = Expression;

where Expression is a general expression, doesn't work. For example,

    int x;
    alias Y = x + x;

doesn't work.

I supposed type mixins could be added, but I haven't seen a request for this before.

--
July 23
https://issues.dlang.org/show_bug.cgi?id=20053

--- Comment #3 from Manu <turkeyman@gmail.com> ---
Oh okay.
Well I run into this all the time. I hadn't noticed the pattern that it was
always type expressions that caused the issue, and I just fellback to mixin the
whole statement.

I'm quite tired of the workaround, and I don't enjoy having to explain it to people (since I can't give then an answer). Consider this such a request! :)

--
July 24
https://issues.dlang.org/show_bug.cgi?id=20053

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|mixin doesn't work for many |add mixin types
                   |expressions                 |

--
July 24
https://issues.dlang.org/show_bug.cgi?id=20053

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@WalterBright created dlang/dmd pull request #10215 "fix Issue 20053 - add mixin types" fixing this issue:

- fix Issue 20053 - add mixin types

https://github.com/dlang/dmd/pull/10215

--
July 29
https://issues.dlang.org/show_bug.cgi?id=20053

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #10215 "fix Issue 20053 - add mixin types" was merged into master:

- a5d3c38852c9c660fb8a6bd929897f5aa3350603 by Walter Bright:
  fix Issue 20053 - add mixin types

https://github.com/dlang/dmd/pull/10215

--