Declaring Ref Variables Inside Function Calls

Sergey Gromov snake.scaly at gmail.com
Tue Mar 31 19:08:18 PDT 2009


Tue, 31 Mar 2009 18:55:10 -0700, Andrei Alexandrescu wrote:

> Sergey Gromov wrote:
>> Tue, 31 Mar 2009 18:38:35 -0700, Andrei Alexandrescu wrote:
>> 
>>> Sergey Gromov wrote:
>>>> Comma expression is not ambiguous.  It's a comma expression.  Renaming
>>>> it into a tuple constructor expression does not add any ambiguity.
>>>> Parentheses here are only required to separate the comma expression from
>>>> an assignment expression which otherwise would become a part of comma
>>>> expression.  Sure there are problems with making tuples first-class, but
>>>> this is certainly not one of them.
>>> I don't understand. So are you suggesting that the comma expression gets 
>>> sacked?
>> 
>> Now comma expression drops all the results but the last one.  You lose
>> nothing by making it keep other results as well.  Then you can make it
>> extract the last element as a result of an implicit cast.
> 
> That won't work because you'd paste C code into your D code and it'll
> compile with different results.

It should be possible to make the C pattern work as expected.  I need to
think about this in more detail to be sure.

>>>> I'm putting together a blog post about a possible design of first-class
>>>> tuples in D.  Hope it won't take too long.
>>> What does "first-class" mean?
>> 
>> First-class values, like, native, with built-in compiler support.
> 
> A tuple is a parameterized type, not a value. And first-class doesn't 
> mean with built-in compiler support.

Probably I've mis-used the first-class thing here.



More information about the Digitalmars-d mailing list