Thread overview
[Issue 19120] Cannot slice a struct with a tuple alias this
Jul 27, 2018
Yuxuan Shui
Jul 27, 2018
Yuxuan Shui
May 23, 2019
Yuxuan Shui
May 23, 2019
Yuxuan Shui
May 08, 2021
Dlang Bot
Dec 17, 2022
Iain Buclaw
July 27, 2018
https://issues.dlang.org/show_bug.cgi?id=19120

Yuxuan Shui <yshuiv7@gmail.com> changed:

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

--- Comment #1 from Yuxuan Shui <yshuiv7@gmail.com> ---
I just came into realization that it is not possible to index a struct with alias this tuple. This seems to be quite inconvenient.

--
July 27, 2018
https://issues.dlang.org/show_bug.cgi?id=19120

Yuxuan Shui <yshuiv7@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |---

--- Comment #2 from Yuxuan Shui <yshuiv7@gmail.com> ---
Actually, we can index that struct.

A revised example:

import std.meta;
struct A(T...) {
    alias S = T;
    alias S this;
}

alias X = A!(int, double);
alias Y = AliasSeq!((X)[0])[0]; // Fine
pragma(msg, Y); // int
alias Z = AliasSeq!((X)[0..$]); // Not fine?

--
May 23, 2019
https://issues.dlang.org/show_bug.cgi?id=19120

Yuxuan Shui <yshuiv7@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEW

--
May 23, 2019
https://issues.dlang.org/show_bug.cgi?id=19120

--- Comment #3 from Yuxuan Shui <yshuiv7@gmail.com> ---
To clarify:

The problem of comment #0 is that Y is actually an array (A!(int, double)[0]).
So that is not a valid example.

But the problem is real, as the example in comment #2 shows. It is possible to index A!(int, double), but not slicing it. Which seems to be an arbitrary limitation.

--
May 08, 2021
https://issues.dlang.org/show_bug.cgi?id=19120

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

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

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@TungstenHeart created dlang/dmd pull request #12505 "fix 19120 - allow CT slicing via `alias this`" fixing this issue:

- fix 19120 - allow CT slicing via `alias this`

  To be consistent with the fact that indexing works

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

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=19120

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
December 13
https://issues.dlang.org/show_bug.cgi?id=19120

--- Comment #5 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/17872

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--