What is D?
Mike Parker
aldacron at gmail.com
Sun Apr 7 14:03:51 UTC 2019
On Sunday, 7 April 2019 at 13:05:14 UTC, Mike Franklin wrote:
> On Sunday, 7 April 2019 at 11:39:01 UTC, Abdulhaq wrote:
>> What is D?
>
> I think D started not as a better C++, but as a better Java. I
> think Walter saw the appeal of Java and wanted to explore
> making it compile to native binaries. There is evidence of
> this with things like `super`, single inheritance with multiple
> interface implementation, the garbage collector, etc. When D
> started it didn't have templates, and I even heard Walter
> forbade templates at first.
It may appear that way, but given what I've learned (and as I've
come to understand) in working on the "Origins of the D
Programming Language", it really was intended as a better C++.
The relevant paragraph from the paper:
'In his years maintaining a C++ compiler, Walter had often
reflected upon the language’s
strengths and weaknesses and the lessons that one could derive
from them in the design of
a new language. He decided it was time to put those ideas into
practice. In October, 1999,
he created a new company, Digital Mars. In November of that year,
he began work on the
design and implementation of a new programming language that he
called “Mars”.'
Single inheritance multiple interfaces was a response to the
problems with multiple inheritance in C++, inspired by Java, but
not in service of being a better Java. Ditto the GC. Walter was
not a fan of GC initially, but in implementing the Symantec Java
compiler, he came to see some benefits that he felt would enhance
even a systems language. Since he opted for the Java model of
classes as reference types, the GC was a natural fit. Java-like
inner classes were an evolutionary feature, implemented only to
make it easier to port a large Java codebase like SWT to D.
As for templates, he was jaded by the complexity of their
implementation and the horribly complex code they could lead to
in general use. It wasn't long after the early alpha releases of
DMD that he had the epiphany that a templated function is just a
function with an extra parameter list. That led to the simpler
syntax and less complex implementation, overcoming his initial
objections.
So yes, his experience implementing Java (in C++!) for Symantec
had an influence on the design and implementation of D, but
several other languages did as well. So did his experience as a
Boeing engineer. But it was a desire to improve upon C++ that was
the impetus, and most of the influences were applied toward
eliminating what he thought as C++ missed or got wrong.
More information about the Digitalmars-d
mailing list