Thread overview
[Issue 4536] New: Typetuples (T...) should have an .init member
Jul 30, 2010
Philippe Sigaud
Aug 19, 2010
Philippe Sigaud
Jun 15, 2011
yebblies
Feb 15, 2012
yebblies
Feb 19, 2012
yebblies
July 30, 2010
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


--- Comment #0 from Philippe Sigaud <philippe.sigaud@gmail.com> 2010-07-30 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: -------
August 19, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4536



--- Comment #1 from Philippe Sigaud <philippe.sigaud@gmail.com> 2010-08-19 22:35:10 CEST ---
(In reply to comment #0)

> 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: -------
June 15, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4536


yebblies <yebblies@gmail.com> changed:

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


--- Comment #2 from yebblies <yebblies@gmail.com> 2011-06-15 08:10:41 PDT ---
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: -------
June 15, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4536


bearophile_hugs@eml.cc changed:

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


--- Comment #3 from bearophile_hugs@eml.cc 2011-06-15 09:48:06 PDT ---
(In reply to comment #2)
> 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: -------
February 15, 2012
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


--- Comment #4 from yebblies <yebblies@gmail.com> 2012-02-15 15:24:34 EST ---
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: -------
February 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4536



--- Comment #5 from github-bugzilla@puremagic.com 2012-02-18 20:36:14 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/809ce857f166a48a05560da95a11fb75fcbb2c1d Merge pull request #719 from yebblies/issue4536

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: -------
February 19, 2012
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: -------