Thread overview
[phobos] phobos commit, revision 2018
Sep 17, 2010
dsource.org
Sep 17, 2010
Shin Fujishiro
Sep 17, 2010
Simen Kjaeraas
Sep 18, 2010
Philippe Sigaud
September 17, 2010
phobos commit, revision 2018


user: rsinfu

msg:
std.typecons: Several improvements to Tuple.

- Tuple members are now accessible with the syntax a[0], a[1] etc.
- Eliminated an internal union (see bug 4421 and 4846). Re-implemented named members with alias.
- Worked around bug 4424. Got opAssign back.
- Made Tuple.slice!(from, to) to preserve field names if any.
- Added isTuple!(T) template.
- Removed the 'default constructor' that is never called.
- Changed Tuple.toString() to use formattedWrite() instead of the `static if (is(to!string...))` thingy.

http://www.dsource.org/projects/phobos/changeset/2018

September 18, 2010
Apparently the bug 2800 have been fixed at some point, so I enabled the alias this in the Tuple.  Does this changeset cause any regression bug? In my local Phobos repo, I changed all x.field[k] in the modules to x[k] and they seemed to work fine.

( http://d.puremagic.com/issues/show_bug.cgi?id=2800 )


Shin
September 17, 2010
Yes yes yes! I am so happy bug 2800 was fixed. This is a huge step towards legitimizing Tuple. I cringed whenever I had to write t.field[0] instead of the natural t[0].

BTW: a large part of the motivation for "alias this" was allowing this very idiom. True story!


Andrei

On 09/17/2010 04:40 PM, dsource.org wrote:
> phobos commit, revision 2018
>
>
> user: rsinfu
>
> msg:
> std.typecons: Several improvements to Tuple.
>
> - Tuple members are now accessible with the syntax a[0], a[1] etc.
> - Eliminated an internal union (see bug 4421 and 4846). Re-implemented named members with alias.
> - Worked around bug 4424. Got opAssign back.
> - Made Tuple.slice!(from, to) to preserve field names if any.
> - Added isTuple!(T) template.
> - Removed the 'default constructor' that is never called.
> - Changed Tuple.toString() to use formattedWrite() instead of the `static if (is(to!string...))` thingy.
>
> http://www.dsource.org/projects/phobos/changeset/2018
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
September 18, 2010
Andrei Alexandrescu <andrei at erdani.com> wrote:

> Yes yes yes! I am so happy bug 2800 was fixed. This is a huge step towards legitimizing Tuple. I cringed whenever I had to write t.field[0] instead of the natural t[0].
>
> BTW: a large part of the motivation for "alias this" was allowing this very idiom. True story!

I don't really post here, but this is too awesome. Finally!

-- 
Simen
September 18, 2010
On Sat, Sep 18, 2010 at 00:58, Simen Kjaeraas <simen.kjaras at gmail.com>wrote:

> Andrei Alexandrescu <andrei at erdani.com> wrote:
>
>  Yes yes yes! I am so happy bug 2800 was fixed. This is a huge step towards
>> legitimizing Tuple. I cringed whenever I had to write t.field[0] instead of the natural t[0].
>>
>> BTW: a large part of the motivation for "alias this" was allowing this very idiom. True story!
>>
>
> I don't really post here, but this is too awesome. Finally!
>


Yeaaaahhhhh!!!
Oh, that's good news indeed. (and an errata less for TDPL). I just tested a
Tuple-equivalent in DMD 2.049 and it works OK.

Oh, and I see that

auto t = tuple();

now works. That's good! It's a common degenerate case with variadic
templates, and Tuple!() is a good unit type (ie: a type with only one value,
namely tuple() / Tuple!()() )


I just tested alias someTuple this with a function call and it doesn't work. Oh well, that's for another time.

int foo(int i, double d, string s) { return 0;}
auto t = tuple(1, 3.1415, "abc");
auto r = foo(t); // doesn't work.



Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20100918/4bc0a0b2/attachment.html>