Discussion Thread: DIP 1042--ProtoObject--Community Review Round 1

Dukc ajieskola at gmail.com
Fri Jan 14 20:22:18 UTC 2022

On Friday, 14 January 2022 at 03:38:28 UTC, tsbockman wrote:
> On Monday, 10 January 2022 at 13:48:14 UTC, Mike Parker wrote:
>> This is the discussion thread for the first round of Community 
>> Review of DIP 1042, "ProtoObject":
>> https://github.com/dlang/DIPs/blob/2e6d428f42b879c0220ae6adb675164e3ce3803c/DIPs/DIP1042.md
> One issue with this DIP that I haven't noticed anyone else 
> raise yet is interface bloat. Each interface directly 
> implemented by a class or any of its super classes adds 
> `size_t.sizeof` to the instance size:

Ouch! Good catch, that is a large issue.

Though I think the culprit here is the habit of class ABI to 
bloat this way, not the DIP. Such instance size bloat punishes 
many otherwise object hierarchies anyway, we want to get rid of 
that regardless of what happens to this proposal.

Still, a serious setback for this DIP. I'd add a proposal in the 
DIP to do something about the bloat. The bloat needs to be solved 
before implementing the DIP, otherwise it's a `sizeof(size_t)` 
more size for every `Object` instance (as `Object` can't be 
implicit in vtable anymore).

More information about the Digitalmars-d mailing list