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

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sat Jan 15 22:57:36 UTC 2022


The DIP is jumping into details without acknowledging that the 
class concept is a high level construct related to OO 
methodology. The design should be rooted in a rationale based on 
specific OO modelling principles (maybe read conference  
proceeding for ideas) and usability.

Since it is a high level concept you essentially should strive to 
make it easy on the programmer and put the burden of optimization 
on the compiler. This must be discussed. For instance, an 
implementation can remove the mutex if it isnt used. It can even 
do so in separate compilation by putting the mutex at a negative 
offset. If you need more details, feel free to ask.

All other OO languages in the Simula family use «object» as the 
root (if they provide one). Deviating from this norm will cause 
confusion and create friction and annoyance among people who have 
an OO background.  The motivation for deviating from this is not 
convincing.

It is desirable to have one root, yet, you propose 3 roots? This 
needs more motivation. D needs to be made simpler, not more 
convoluted.

I am not getting into the specifics of interfaces, but as 
implemented they are to be avoided as they cost 8 bytes per 
instanced object per interface. So it is better to adorn the root 
object with abstract virtuals which are free. If you want to 
force interfaces on developers then you need to provide an 
interface mechanism that is usable (the current one is too 
expensive).

The list of popular languages at the end does not seem motivated. 
Why only these commercial languages and why listing them? By not 
referencing more academic OO resources the reader will get the 
impression that you did not do a proper survey and that the DIP 
as written is more of an early sketch than a final design.



More information about the Digitalmars-d mailing list