Why I chose D over Ada and Eiffel

Ramon spam at thanks.no
Wed Aug 21 06:54:54 PDT 2013


On Wednesday, 21 August 2013 at 05:41:40 UTC, Jesse Phillips
wrote:
> Personally I'm not familiar with Eiffel or some of the more 
> eccentric polymorphic functions. I know my templates, Java/C# 
> generics and object base polymorphic behavior.

Finally someone says it honestly, frankly and straight out.
Thank you for that. I mean it.

And I understand you perfectly well. Having quired a considerable
amount of knowledge and experience with a language one , of
course, tends to develop a certain relationship and a habit to
understand every (programming related) problem as "How could tat
be done in 'my' language?"

This goes further than we sometimes (like to) see. The
"Polymorphism is bad/troublesome" credo, for instance, has
basically nothing to do with polymorphism and pretty everything
with C++'s attempt at it.

We may like it or not but language designers, being human beings,
have beliefs, intentions and goals when creating a language. And
it's no secret; after all this mix (of beliefs, goals, etc.) is a
major driving force to energize the tedious process. D's creators
spell it out quite frankly and it comes down to something like
"To create the language C and C++ should have been".

Please note that I do not judge that as good, bad or whatever
and, in fact, I do agree that this is actually a constructive and
valid approach.

There are even people around who created (usually script)
languages with games in mind.

Ada didn't need such a kind of belief/goal mix; it was put right
in front of them by the usa dod. One, probably *the* major issue
was reliability, correctness and, if any feasible, verifyability.

And this mind- and goalset very much shapes the outcome. That is
why in Ada ':=' is used as assignment operator while in C, C++
and D '=' is used.

And then there is Eiffel, which is very interesting if for one
issue alone: It's creator wanted to create "The whole process
from design down to code right". And, unlike what many think,
Prof Meyer/Eiffel *does* care about practical aspects.

I myself was turned off by Ada's and Eiffel's (and Pascal's and
its derivates) use of ':=' for assigment (which on a german
keyboard is even more unpleasant than on a querty version).
Until I read real world statistics (which well matched my own
experience) that showed how error prone the '=' way is.

The killer argument, however, (in my case) was delivered by Prof.
Meyer in a statement along the line "It doesn't matter how fast
your code is if it breaks"

Reading through this forum, however, "performance" and not doing
anything that might negatively influence performce is what Mother
Mary is to Christians, very very holy.

Again, this mindset is perfectly valid and OK. But one should at
least be really and seriously conscious of it.

Polymorphism, for instance, *can* be done and done well, up to
the point of being a treasure trove and a realiable and efficient
was to do things.
It will, however, never even being seriously considered by a
C/C++ mindset considering it evil and whatnot.

To be frank, I will try to find a way to use D (which I still
consider a great language!) in a rather ignorant and Eiffel-like
way, as well as this can be done (Yes, I will even use ':=' and
have it auto-replaced before compiling).

For two simple reasons: Probably I'm to "rotten" to happily use
anything else than a modern C family Language (D) but I'm not
willing to simply forget what important lessons I learned while
wandering through other parts of the programming world.
The second reason is that D (for my personal taste) is too C/C++
in the sense of a "Well, paint something here, glue something on
top there". I read again and again how elegant and well readable
D is. Sorry, no, it isn't, or, to be more correct, it is only if
seen from someone who has been exposed to (and/or possibly likes)
C/C++ cryptic (~non natural for a human) looks.

Funnily one thing I particularly love with D, the "scopes", is
something I know - less well done than in D - from Eiffel and
which is credo of mine since long: Forget the f*cking "try"!.
Either be honestly careless )"Hey, it's just an unimportant
script kind a thingy") or - very reasonably - assume that pretty
everything can go wrong. "try" somehow (stupidly, I feel) implies
that there is "innocent" code and "potentially dangerous" code.
BS! On a modern system with zillions sloc written by thousands of
varying levels of professionality *nothing* can be assumed to be
innocent.

> In D it tends to be idiomatic to specify what you will use and 
> not why structure you expect. So instead of:
>
>     void foo(IComparable[] data)...
>
> We write:
>
>     void foo(Range)(Range data) 
> if(isComparable!(ElementType!Range))...
>
> Where isComparable would need to be defined and ElementType can 
> be found in std.range.
>
> So D's generics may be lacking, the ability to write generic 
> algorithms is still there.

As long as I can have "generics" and not merely a very smart
fill-in template system - or, even better, both - I'm content
enough.

BTW: One of the reasons I'm discussing (probably to an extent
that many feel going to far) is because I know myself. It is
*now* (with some spare time and not yet deeply involved actually
using D) or never. Once I'm in everyday use mode I'll do what
pretty everyone does, namely, code by using what is there and
available; whatever I'll miss I will somehow work around, peeling
apples with spoons ...


More information about the Digitalmars-d mailing list