skinny delegates

Mike Franklin slavo5150 at yahoo.com
Thu Aug 2 13:48:01 UTC 2018


On Monday, 30 July 2018 at 21:02:56 UTC, Steven Schveighoffer 
wrote:

> In this case, D allocates a pointer on the heap to hold "x", 
> and then return a delegate which uses the pointer to read x, 
> and then return that plus 10.

Yeah, that seems like such a disproportionately heavy cost.

> Does it make sense?

I haven't though through the details, but if it can be done, I 
think it would be nice.  I like when programming tools are more 
intelligent about things like this because after you become 
familiar with it and build confidence in it, you can just code 
your ass off and know that the compiler is doing right on your 
behalf.

Mike




More information about the Digitalmars-d mailing list