DIP19: Remove comma operator from D and provision better syntactic support for tuples

Jacob Carlborg doob at me.com
Mon Sep 24 12:16:06 PDT 2012


On 2012-09-24 15:05, deadalnix wrote:

> I understand your example, but in it, no (int) are involved. So no
> conversion have to be done (and you get an error).

What has that to do with anything. Example:

auto a = 3;

There's no mention of "int" in that example, yet "a" is still an int.

> You see in example above that conversion is done when int is given where
> (int) is expected or vice versa, not whenever the compiler feels to.

int b = 4;
b[0]

Why isn't that an example of where a (int) is expected? I'm no expert on 
how the compiler does semantic analyze but if it sees something like 
"b[0]" then it thinks: it's either an array, a pointer, an associate 
array, opAssign or now a tuple. Then it thinks: hey an int is implicitly 
convertible to a one element tuple, I do that.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list