Bug 18903 – std.signals uses _dtor

Status
NEW
Severity
minor
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-05-24T12:22:48Z
Last change time
2024-12-01T16:33:51Z
Assigned to
No Owner
Creator
Steven Schveighoffer
See also
https://issues.dlang.org/show_bug.cgi?id=16203
Moved to GitHub: phobos#9760 →

Comments

Comment #0 by schveiguy — 2018-05-24T12:22:48Z
std.signals uses the underlying function __dtor in the disconnectAll function to call the local destructor within a mixin. Technically, this may be correct -- it only calls the mixin's dtor, it does not call any other destructors for the class, including base classes or derived classes. However, this is a very BAD pattern to have inside phobos. Not only is it confusing, it gives the impression that __dtor is an acceptable way for normal destructor invocation. The only thing that disconnectAll does besides call the destructor is set a couple of values. Instead of having disconnectAll do very little and call the destructor, just have the destructor call disconnectAll. The added overhead of reinitializing idx and status is inconsequential. And then it's less magic.
Comment #1 by robert.schadek — 2024-12-01T16:33:51Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9760 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB