Thread overview
[Issue 6367] Multi-assignment for typetuples is bad
Apr 01, 2014
Kenji Hara
March 31, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=6367



--- Comment #1 from monarchdodra@gmail.com 2014-03-31 07:25:30 PDT ---
Is this an actually documented feature?

Does the spec say it works, or does it just happen to look that way...?

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 01, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=6367


Kenji Hara <k.hara.pg@gmail.com> changed:

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


--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2014-03-31 19:14:06 PDT ---
(In reply to comment #1)
> Is this an actually documented feature?
> 
> Does the spec say it works, or does it just happen to look that way...?

It's properly documented.

http://dlang.org/tuple

> Tuple Declarations
> 
> A variable declared with a TypeTuple becomes an ExpressionTuple:
> 
> alias TL = Tuple!(int, long);
> 
> void foo(TL tl)
> {
>     writeln(tl, tl[1]);
> }
> 
> foo(1, 6L);	// prints 166

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 01, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=6367



--- Comment #3 from monarchdodra@gmail.com 2014-03-31 23:19:14 PDT ---
(In reply to comment #2)
> (In reply to comment #1)
> > Is this an actually documented feature?
> > 
> > Does the spec say it works, or does it just happen to look that way...?
> 
> It's properly documented.
> 
> http://dlang.org/tuple

That page makes no mention of initialization. It merely states that: "A variable declared with a TypeTuple becomes an ExpressionTuple"

I'm asking about said items initialization scheme:

//----
import std.typetuple;

void main()
{
   alias T = TypeTuple;
   T!(int, int) t1 = T!(1, 2); // OK
   T!(int, int) t2 = 1; // OK?
}
//----

Further, std.typecons.Tuple does not support such an initialization scheme.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 01, 2014
https://d.puremagic.com/issues/show_bug.cgi?id=6367


bearophile_hugs@eml.cc changed:

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


--- Comment #4 from bearophile_hugs@eml.cc 2014-04-01 01:35:23 PDT ---
Reopened because I see no valid reason to close this yet. And even if the specs say that typetuples should behave like this, I'll reopen this as enhancement (because in that case I think it's a spec bug).

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