Classes in D with betterC

Luís Ferreira contact at lsferreira.net
Sun Nov 21 20:30:51 UTC 2021


On Sat, 2021-11-20 at 06:15 +0000, Stanislav Blinov via Digitalmars-d-
announce wrote:
> On Saturday, 20 November 2021 at 05:37:42 UTC, rikki cattermole 
> wrote:
> > And then there are issues such as 
> > https://issues.dlang.org/show_bug.cgi?id=21416 which killed off 
> > any chance of me using them internally.
> 
> ...and the implementation, as presented, falls apart due to not 
> forwarding arguments correctly. Not insurmountable, of course, 
> although `forward` really should be an intrinsic and not a 
> library function.
> 
> And due to looking for a `__dtor` instead of `__xdtor`. And due 
> to the fact that ya can't use the proposed `destroy` function 
> with a reference to base class and still call the destructor of 
> derived class correctly, let alone infer attributes correctly. 
> And due to it trusting the `pureFree` when it shouldn't.
> 
> Can't see anything news-worthy here. This has been possible for 
> ages, and is still limited to wazoo by classes being married to 
> druntime, pessimized by lack of proper forwarding in the 
> language, and can't be @safe.

I decided to have a simple approach just to show that it is easier now
to do that without workarounds, and by workarounds, I mean using scope
to fetch that info and use a fake dtor, or even before scope exists,
the usage of runtime-less D call with betterC + objcopy, described
[here](https://theartofmachinery.com/2018/05/27/cpp_classes_in_betterc.
html).

-- 
Sincerely,
Luís Ferreira @ lsferreira.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-announce/attachments/20211121/0f1e37bc/attachment.sig>


More information about the Digitalmars-d-announce mailing list