[Issue 17642] New: Specify in the documentation for destructors the problem with the error InvalidMemoryOperationError
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jul 12 11:19:11 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17642
Issue ID: 17642
Summary: Specify in the documentation for destructors the
problem with the error InvalidMemoryOperationError
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dlang.org
Assignee: nobody at puremagic.com
Reporter: crimaniak at gmail.com
The current implementation of GC is not re-enterable so users regularly receive
an unexpected InvalidMemoryOperationError. The only reliable way to avoid this
error is not to create garbage-collected instances of objects or structs with
non- at nogc destructor. There is no information about it in the documentation,
except error itself description. Nobody reads all possible errors descriptions
before writing code. So then user faced this error usually it's too late to
change architecture and think about ~this() @nogc.
So I propose to add info about this error and how to avoid this to destructors
documentation page
https://dlang.org/spec/class.html#destructors
or as minimum write a short warning about and give the link to the page with
extended info https://wiki.dlang.org/InvalidMemoryOperationError
--
More information about the Digitalmars-d-bugs
mailing list