Multiple destructors

Alex Biscotti skyswood at gmail.com
Fri May 26 09:39:29 UTC 2023


On Friday, 26 May 2023 at 09:24:29 UTC, Ernesto Castellotti wrote:
> On Friday, 26 May 2023 at 09:17:34 UTC, Alex Biscotti wrote:
>> On Friday, 26 May 2023 at 09:11:47 UTC, Ernesto Castellotti 
>> wrote:
>>> On Friday, 26 May 2023 at 09:07:07 UTC, Alex Biscotti wrote:
>>>> 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)?
>>>>
>>>> [...]
>>>
>>> This is a bug to me, you should open an issue on bugzilla
>>
>> Do you mean that it's a bug in the documentation or 
>> implementation of the language?
>
> Bug in the implementation of Mixin Template

Hmm, this feature is used in Phobos in 
[std.signal](https://github.com/dlang/phobos/blob/master/std/signals.d#L259). Actually, this is how I found it, since I implemented the Signal functionality, but without garbage collection. It seems to me that this is an undocumented feature, rather than a bug.


More information about the Digitalmars-d-learn mailing list