www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18903] New: std.signals uses _dtor

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 puremagic.com
          Reporter: schveiguy 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.

--
May 24 2018