DIP23 draft: Fixing properties redux

deadalnix deadalnix at gmail.com
Sun Feb 3 07:27:57 PST 2013


On Sunday, 3 February 2013 at 15:04:15 UTC, Steven Schveighoffer 
wrote:
> On Sun, 03 Feb 2013 08:04:10 -0500, Timon Gehr 
> <timon.gehr at gmx.ch> wrote:
>
>> T delegate() f = &a.prop -> auto f = ()=>a.prop;
>> T delegate(T) f = &a.prop -> auto f = (T x)=>a.prop=x;
>
> I don't like this solution.  You are creating a dummy delegate 
> function, and moving the stack frame into the heap, just so you 
> can get a delegate to an already existing function.
>
> -Steve

Unless you escape the delegate, it should allocate on the heap. 
And any inlining compiler should remove the delegate completely 
anyway.


More information about the Digitalmars-d mailing list