Tuple literal syntax

Simen kjaeraas simen.kjaras at gmail.com
Sun Oct 10 07:06:52 PDT 2010


Stephan Soller <stephan.soller at helionweb.de> wrote:

> However as soon as these fields are named it looks to me like an  
> ordinary structure. So why not just create something like an "anonymous  
> structure literal" that behaves to structures like anonymous functions  
> (or delegates) to functions?

Perhaps it would be possible to augment struct static initializers for
this purpose?

{ int a; string b } foo( ) {
     return { 1, "text" };
}

I'm not sure if there are problems with this syntax (it sorta looks
like a delegate, for one), so elucidation would be welcome.


-- 
Simen


More information about the Digitalmars-d mailing list