Can we fix this?
deadalnix
deadalnix at gmail.com
Thu Sep 30 19:41:54 UTC 2021
On Thursday, 30 September 2021 at 14:07:18 UTC, Sebastiaan Koppe
wrote:
>> I have good news for you: the compiler knows what you capture
>> and what you don't, so the only case where in which you'll
>> have unnecessary reference, is if you capture explicitly and
>> mess it up.
>
> The upside with explicit capture is that you can specify you
> want a move/copy instead of a reference, side-stepping the OT's
> decade long problem.
You can create a copy in a local variable though, if you need a
capture by value.
Now, one thing that we might want are delegates with a strongly
typed closure, as in C++. There are obvious downsides. To begin
with, each delegate is of a different type and ABI.
If that is ever added to D, it should probably need to be a new
feature, different from current delegates.
More information about the Digitalmars-d
mailing list