What is the stance on partial initializers when declaring multiplevariables of the same type?
Simen Kjaeraas
simen.kjaras at gmail.com
Thu Jul 21 16:44:48 PDT 2011
On Thu, 21 Jul 2011 23:40:08 +0200, bearophile <bearophileHUGS at lycos.com>
wrote:
> Nick Sabalausky:
>
>> Crazy, nutty, wacky idea...
>>
>> float (a, b, c) = 0.0;
>
> I'd like some syntax sugar for tuples in D (especially for their
> unpacking), that syntax goes against one of the most natural ways to
> define tuples. So it's not a good idea.
It is highly unlikely that D will ever adopt that syntax for tuples,
due to the previously much-discussed comma operator (which, while
uncommon, is useful at times). I believe the syntax that came out on
top in earlier discussions was the upended hamburger bun, or banana
syntax:
(| float f, string s |) foo = (| 1.2, "Eh, whut?" |);
(do note that I enjoy a wide variety of toppings on my burgers :p)
Even if the comma operator were removed and that syntax used for
tuples, Nick's suggested syntax would not cause ambiguities.
--
Simen
More information about the Digitalmars-d
mailing list