Improve the OOP ABI

deadalnix deadalnix at gmail.com
Thu Sep 28 14:31:33 UTC 2023


On Thursday, 28 September 2023 at 13:05:01 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> On 29/09/2023 1:42 AM, deadalnix wrote:
>> 1/ Downcast to final classes.
>
>> ```d
>> auto foo(A a) {
>>      return typeid(a) is typeid(B) ? a : null;
>> }
>> ```
>
> TypeInfo isn't guaranteed to be unique to a process when 
> dealing with shared libraries. There is a strong chance it'll 
> be duplicative.
>
> So this won't work.
>

lol, wat?

That sounds crazy.

>> 2/ Inline ClassInfo with the vtbl.
>
> ClassInfo is an alias to TypeInfo_Class now. This indirection 
> shouldn't exist.
>
> https://github.com/dlang/dmd/blob/a6285c26c0e04b9b3b1d40ae1c3200c834df1480/druntime/src/object.d#L1737

It does exist.


More information about the Digitalmars-d mailing list