What are the prominent downsides of the D programming language?

Jean-Louis Leroy jl at leroy.nyc
Tue Sep 29 18:26:42 UTC 2020


On Tuesday, 29 September 2020 at 17:33:47 UTC, mw wrote:
> On Tuesday, 29 September 2020 at 09:56:47 UTC, Petar Kirov 
> [ZombineDev] wrote:
>> I think one extravagant, but definetely workable solution 
>> would be create a template DSL (ofc it could also be string 
>> mixin-based) in D to prototype a multiple
>> inheritance system (with e.g. the Eiffel features `rename`, 
>> `export`, `undefine`, `redefine` / `override`, and `select`). 
>> Being just a prototype, it should be acceptable to go with 
>> custom functions like `isSubTypeOf`, `asBaseType`, etc., 
>> instead of using the built-in language syntax and semantics. 
>> (Sort of like https://code.dlang.org/packages/openmethods adds 
>> multiple dispatch.)
>
> This is an interesting idea, basically implement the Eiffel 
> compiler (the OO part) as a D library, and perhaps also use 
> openmethods, then we will have a Lisp's multi-methods + Eiffel 
> OO inheritance.
>
> I'm not sure how complex this implementation is going to look 
> like.

There are precedents to this approach. One is fairly well known: 
CLOS, which is an object system that supports open multi-methods 
and multiple inheritance (and method combination, which I don't 
find very convincing). CLOS is written entirely in Common Lisp.

Another example is COS: the C Object System 
(https://github.com/CObjectSystem/COS). COS is pretty much CLOS 
written in C and CPP macros.

D is a great language for experimenting with language features. 
Maybe not as good as Lisp (at least currently) but certainly much 
better than C. I know at least two examples: Atila's tardy 
(golang-style interfaces) and my own openmethods.

Regarding mutliple inheritance, I have always been convinced that 
it was a good feature. Or rather, that restricting inheritance to 
single is completely unnatural. My very first open source project 
was a modified version of Microsoft's MFC library that supported 
multiple inheritance.

I think that C++ got something right: sometimes we need shared 
inheritance, and sometimes repeated inheritance. Although, in my 
experience, I rarely needed repeated inheritance. CLOS, in 
contrast, gives you only one option, namely, shared inheritance. 
On the other hand, C++ makes the sharing of a base a property of 
the inheritance relationship (virtual inheritance), not of the 
base. So, if a base is inherited non-virtually in an inheritance 
lattice, it becomes impossible to request only one copy when 
merging hierarchies. Perhaps it should be up to the deriving 
class to specify the inheritance lattice, including which 
sub-objects are shared and which are repeated.

Anyway, back to mw's post, I am pretty sure that it is possible 
to write a fairly good CLOS in D.



More information about the Digitalmars-d mailing list