skinny delegates
soulaïman
sahmi.soulaimane at gmail.com
Fri Oct 26 22:04:21 UTC 2018
On Monday, 30 July 2018 at 21:02:56 UTC, Steven Schveighoffer
wrote:
> Would it be a valid optimization ... is an rvalue, and would
> fit into the data pointer part of the delegate?
> ...
> -Steve
If you want to optimize for rvalues then why not just do like
some other languages, namely Java and Objective-C? They just make
these rvalue/const variables part of the delegate's stack
essentially they just make a copy at the delegate construction.
Java doesn't have value types and it only allows const variables
(they call them "final") to be used by delegates only to be able
to make a copy like I said. Objective-C defaults to const refs
for closures but and require explicit captures for mutable refs
to allocates these on the heap instead of just copying them the
closure's stack.
More information about the Digitalmars-d
mailing list