[Issue 6365] AutoTupleDeclaration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 24 12:20:05 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6365



--- Comment #21 from Kenji Hara <k.hara.pg at gmail.com> 2011-07-24 12:20:00 PDT ---
(In reply to comment #20)
> This too is valid D code:
> 
> auto a = [1, 2,];

I didn't know that. Thank you.

<cut>
In this case, TupleDeclaration syntax is similar to ParameterList.

void f(int i, string j){ ... }
(int i, string j) = tuple(1, "a");
auto (i, j) = tuple(1, "a");

But, 1 parameter function does not allow isolated comma.

void f(int i){ ... }
(int i) = tuple(1);
auto (i) = tuple(1);

//void f(int i,){ ... }  // invalid
//(int i,) = tuple(1);   // associatively invalid
//auto (i,) = tuple(1);  // associatively invalid

How about you?
</cut>

I didn't know following syntax is valid...

void f(int i, ){  }
(int i,) = tuple(1, "a");  // associatively valid
auto (i,) = tuple(1, "a"); // associatively valid

Hmm, it is hard achnowledgment to me, but it is valid syntax for consistency...

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


More information about the Digitalmars-d-bugs mailing list