[Issue 18903] New: std.signals uses _dtor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 24 12:22:48 UTC 2018


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

          Issue ID: 18903
           Summary: std.signals uses _dtor
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: schveiguy at yahoo.com

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.

--


More information about the Digitalmars-d-bugs mailing list