Thread overview
[Issue 20053] mixin doesn't work for many expressions
Jul 16, 2019
Basile-z
Jul 23, 2019
Walter Bright
Jul 23, 2019
Manu
[Issue 20053] add mixin types
Jul 24, 2019
Walter Bright
Jul 24, 2019
Dlang Bot
Jul 29, 2019
Dlang Bot
Mar 21, 2020
Basile-z
Apr 02, 2021
Dlang Bot
July 16, 2019
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, 2019
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, 2019
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, 2019
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, 2019
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, 2019
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

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=20053

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

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

--
April 02, 2021
https://issues.dlang.org/show_bug.cgi?id=20053

--- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #12339 "[dmd-cxx] Backport fixes and trivial features from upstream dmd" was merged into dmd-cxx:

- a749391899e307be076a5202d9b0cc5e48240f4b by Walter Bright:
  [dmd-cxx] fix Issue 20053 - add mixin types

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

--