Thread overview
[Issue 17563] gc_inFinalizer should be public
Jun 27
ponce
6 days ago
safety0ff.bugz
June 27
https://issues.dlang.org/show_bug.cgi?id=17563

ponce <aliloko@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aliloko@gmail.com

--- Comment #1 from ponce <aliloko@gmail.com> ---
Note: This "crude and horrible way" helped me find plenty of bugs where I would rely on the GC to release a resource, and I only do this in debug clauses so it hardly really matter how ugly it is. It's a programming error, so I make it crash right away.

--
June 30
https://issues.dlang.org/show_bug.cgi?id=17563

--- Comment #2 from Steven Schveighoffer <schveiguy@yahoo.com> ---
ponce, it's not a slight against your mechanism. It's a problem with the API. There is no reason you should have to go through the hoops of attempting to allocate memory and catching an Error, just to check the value of a global boolean. Especially when there is already a function that does just that.

--
June 30
https://issues.dlang.org/show_bug.cgi?id=17563

ZombineDev <petar.p.kirov@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |petar.p.kirov@gmail.com

--
6 days ago
https://issues.dlang.org/show_bug.cgi?id=17563

safety0ff.bugz <safety0ff.bugz@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |safety0ff.bugz@gmail.com

--- Comment #3 from safety0ff.bugz <safety0ff.bugz@gmail.com> ---
An alternative solution worth considering is adding a parameter to destructors
(e.g. ~this(bool gcfinalizer=false)) and have the compiler handle
compatibility.

The advantage is that it is a better interface for future/alternate GC sweep implementations. For example lazy/incremental sweep, concurrent sweep would need to use thread local variables to manage the status.

--