Ref local variables?

Steven Schveighoffer schveiguy at yahoo.com
Mon Jan 9 07:13:34 PST 2012


On Mon, 09 Jan 2012 09:27:06 -0500, bearophile <bearophileHUGS at lycos.com>  
wrote:

> Steven Schveighoffer:
>
>> With new => syntax (in git head), this would probably be:
>>
>> @property ref tile => map[y*w+x];
>
> That's not currently supported:
> http://d.puremagic.com/issues/show_bug.cgi?id=7176

The given function is not a method, but it is an inner-class function.

But you are right, it's a named function not a lambda.  I'm not too  
concerned about whether this version works or not, the other version is  
reasonably short.

I wonder if this would work, but it wouldn't be inlined like my original  
example:

auto tile = @property ref () => map[y*w+x];

-Steve


More information about the Digitalmars-d-learn mailing list