DIP32: Uniform tuple syntax
Chris Nicholson-Sauls
ibisbasenji at gmail.com
Tue Apr 2 14:05:08 PDT 2013
On Tuesday, 2 April 2013 at 06:42:00 UTC, Jacob Carlborg wrote:
> On 2013-04-02 02:16, Chris Nicholson-Sauls wrote:
>> Two different languages I've used in the distant past used @
>> for expansion.
>>
>> auto t1 = {1, "hi"};
>> auto t2 = {2, "yo"};
>>
>> auto t3 = {t1, t2}; // == {{1, "hi"}, {2, "yo"}}
>> auto t4 = {@t1, @t2}; // == {1, "hi", 2, "yo"}
>>
>> Are there still unspecified plans for @, or is it now
>> available for
>> something like this?
>>
>> Regarding the $ident syntax (which I was glad to see, since my
>> first
>> question when reading the DIP was whether a way existed to do
>> that),
>> couldn't the @ syntax then be allowed for this as well, with
>> expansion
>> of a scalar defined as the scalar itself?
>>
>> int x = 1;
>> if ( auto {@x, y} = tmp ) // {1, y} = tmp
>>
>> if ( auto {x, y} = tmp } // same as in DIP
>
> Won't there be a conflict with UDA's?
Oh yeah, those exist. (I seriously forgot... just because I
haven't gotten to play with recent D releases any.)
More information about the Digitalmars-d
mailing list