Let's get the semantic around closure fixed.
Adam D. Ruppe
destructionator at gmail.com
Wed May 19 19:29:35 UTC 2021
On Wednesday, 19 May 2021 at 19:01:59 UTC, Walter Bright wrote:
> Having a hidden allocation per loop will be completely
> unexpected for such a simple looking loop for a lot of people.
> That includes pretty much all of *us*, too.
Citation needed.
It is fairly well known that closures and objects are pretty
interchangeable, so the allocation should surprise nobody. This
is a very common pattern in several languages. And even ones that
don't do this have workarounds - a function returning a function
that gets called to capture the arguments (this works in D as
well btw) - since the allocation is kinda the point of a closure.
Whereas the current behavior surprises most everybody AND is
pretty useless.
More information about the Digitalmars-d
mailing list