DIP32: Uniform tuple syntax

Chris Nicholson-Sauls ibisbasenji at gmail.com
Mon Apr 1 17:16:59 PDT 2013


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



More information about the Digitalmars-d mailing list