Hello everyone! While researching the phobos library, I discovered that a class can have multiple destructors if the destructors are added via mixin injection. Accordingly, the question is whether a description of such feature should be added to the documentation, since the current description is a bit confusing - ["There can be only one destructor per class"](https://dlang.org/spec/class.html#destructors)?

Here's a code demo of what I'm talking about:
```d
import std;

mixin template AddNewDtor()
{
    ~this()
    {
        writeln("Mixin dtor");
    }
}

class Foo
{
    ~this()
    {
        writeln("Class dtor");
    }

    mixin AddNewDtor;
}

void main()
{
    {
        auto s = scoped!Foo;

        // prints `Mixin dtor`
        // prints `Class dtor`
    }
}
```

Reply via email to