DIP32: Uniform tuple syntax

Jacob Carlborg doob at me.com
Mon Apr 1 23:42:00 PDT 2013


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?

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list