Thread overview
[Issue 6474] New: aliasing type tuple elements' members is onerous
Aug 12, 2011
Ellery Newcomer
Feb 08, 2013
Andrej Mitrovic
Feb 10, 2013
Andrej Mitrovic
Mar 31, 2013
Andrej Mitrovic
August 12, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6474

           Summary: aliasing type tuple elements' members is onerous
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: ellery-newcomer@utulsa.edu


--- Comment #0 from Ellery Newcomer <ellery-newcomer@utulsa.edu> 2011-08-11 19:32:04 PDT ---
code like

struct X(T){
    alias T TT;
}
alias TypeTuple!(int,int, X!string) G;
alias G[2].TT TT; // <-- parse failure

doesn't work. It's just not built in to the D grammar.

Of course, the workaround is simply

alias G[2] G2;
alias G2.TT TT;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6474


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-08 15:28:59 PST ---
*** Issue 5697 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 10, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6474



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-02-10 09:10:37 PST ---
*** Issue 6740 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 31, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=6474



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-03-31 13:36:42 PDT ---
Just pasting this here as I've ran into it again:

template test(T, Preds...)
{
    enum bool test = Preds[0]!T;  // error: semicolon expected, not '!'
}

A workaround is to use an alias:

template test(T, Preds...)
{
    alias Pred = Preds[0];
    enum bool test = Pred!T;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------