https://issues.dlang.org/show_bug.cgi?id=2043

--- Comment #29 from timon.g...@gmx.ch ---
(In reply to Walter Bright from comment #27)
> D closures are "by reference" rather than "by value". I make use of it being
> by reference all the time, as well as it being much more efficient. Changing
> it would likely break all sorts of code. So then the question is, what to do
> if you want it by value?
> ...

No, this is not about this distinction. Other programming languages, even those
that always capture by reference, do not have this problem. This form of memory
corruption cannot reasonably be defined away as a language feature.

> Now, the compiler could actually rewrite the delegate into the nested form
> above, but as I said, this changes the semantics of existing code, as well as
> being pretty inefficient. I doubt it would be acceptable.

All bug fixes change behavior of existing code. The current behavior is
unacceptable.

--

Reply via email to