Comma expressions must die [Was: Reddit: why aren't people using D?]
Tom S
h3r3tic at remove.mat.uni.torun.pl
Thu Jul 23 15:49:29 PDT 2009
Adam D. Ruppe wrote:
> On Fri, Jul 24, 2009 at 12:03:37AM +0200, Michiel Helvensteijn wrote:
>> Would you look at this page and give me your opinion?
>
> Looking at it quickly, the big difference seems to be you leave the tuple
> word off, and use them in more places.
>
> Is
>
> Tuple!(int, bool) A = tuple(a, b)
>
> really that much worse than:
>
> (int, bool) A = (a, b)
>
> ?
>
> Better yet, of course is:
>
> auto A = tuple(a, b);
It's not much worse, but it's not everything that's to tuples. Here's
one more example:
> int a, b;
----
> a, b = 2, 3;
Can't do it with tuple(a, b) = tuple(2, 3);
One would have to create yet another helper function, e.g.
> ptuple(&a, &b) = tuple(2, 3);
Or perhaps something with 'ref' instead of pointers, but I remember it
being buggy with tuples, and might be too dangerous, since you wouldn't
see that you're passing pointers around
--
Tomasz Stachowiak
http://h3.team0xf.com/
h3/h3r3tic on #D freenode
More information about the Digitalmars-d
mailing list