On Thursday, 31 October 2013 at 00:46:05 UTC, Xiaoxi wrote:
On Wednesday, 30 October 2013 at 21:15:37 UTC, Ali Çehreli wrote:
On 10/29/2013 10:55 AM, Ali Çehreli wrote:

> Continuing the conversation from the following thread:
>
>   http://forum.dlang.org/post/[email protected]

Kenji Hara added there:

=====
The combination of closure variables + scoped destruction should
be rejected, but currently it isn't. It's a compiler bug.

http://d.puremagic.com/issues/show_bug.cgi?id=11382

Kenji Hara
=====

Ali

kenji is right. compilation error is the only safe approach, if you do not wish scoped destruction, don’t request it in the first place! dangerous operations like this should be explicit to avoid surprises, not hidden in complicared implicit special cases.

This is wrong in a point that accessing object or not running destructor is not safe: closures can touch any object, not only structs, making them allocated in heap, and there are many cases when struct destructors are not called.

Reply via email to