[phobos] phobos commit, revision 1516

Andrei Alexandrescu andrei at erdani.com
Sat May 22 07:16:34 PDT 2010


I don't think tie() is good for us, sorry for not voicing this earlier.

Since it takes the addresses of references and it escapes them into a 
struct for later use, it is inherently unsafe.

I suggest we replace tie() with a typesafe alternative, for example 
scatter(). Instead of

int    n;
double d;
tie(n, d) = tuple(10, 3.14);
assert(n == 10);
assert(d == 3.14);

we have the safe alternative:

int    n;
double d;
scatter(tuple(10, 3.14), n, d);
assert(n == 10);
assert(d == 3.14);


What do you all think?

Andrei


On 05/17/2010 11:19 AM, dsource.org wrote:
> phobos commit, revision 1516
>
>
> user: Masahiro Nakagawa
>
> msg:
> Add tie to std.typecons
>
> http://www.dsource.org/projects/phobos/changeset/1516
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos


More information about the phobos mailing list