www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4536] New: Typetuples (T...) should have an .init member

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4536

           Summary: Typetuples (T...) should have an .init member
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: philippe.sigaud gmail.com



12:05:32 CEST ---
Typetuples (T...) should have an .init member. Them not having it is a bother
for generic code.

Say I have a template that takes an alias and a T..., and I want to verify that
the alias is a function accepting T...:

template Test(alias fun ,T...)
if (is(typeof(fun(T.init)))
{...}

This does not work, which I find frustrating.

I have to use this workaround:

template Init(T...)
{
    alias (Tuple!T.init).expand Init;
}

That is, using std.typecons.Tuple as an initiator.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 30 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4536




22:35:10 CEST ---


 template Init(T...)
 {
     alias (Tuple!T.init).expand Init;
 }
Hmm, my mistake, the previous version doesn't work. I'm pretty sure it used to, since I was using it in my code. Anyway, here is a far more simple version, no dependency: template Init(T...) { T Init; } a initialized T is correctly created. I still think .init should work like this for typetuples. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 19 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4536


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com



What should .init do for a TypeTuple like this?
TypeTuple!(3, int).init = ?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 15 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4536


bearophile_hugs eml.cc changed:

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




 What should .init do for a TypeTuple like this?
 TypeTuple!(3, int).init = ?
I think raise a syntax error (or return a TypeTuple!(3, 0)). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 15 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4536


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid
         AssignedTo|nobody puremagic.com        |yebblies gmail.com



https://github.com/D-Programming-Language/dmd/pull/719

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4536




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/809ce857f166a48a05560da95a11fb75fcbb2c1d


Issue 4536 - Typetuples (T...) should have an .init member

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 18 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4536


yebblies <yebblies gmail.com> changed:

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


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