documentation and papers about const/invariant

Sean Kelly sean at invisibleduck.org
Tue May 20 08:02:48 PDT 2008


== Quote from Ary Borenszweig (ary at esperanto.org.ar)'s article
> Dee Girl escribió:
> > Next part is even worse. How Does C++ Const Stack Up? is the title. Makes me mad! I read about C++
const. Things I knew. Fine. But then when the part ends what do I see? Scroll bar is at 80%. Most article discuss
C++! I can not believe this. This is article written with attitude bitter and sad about C++. Does article want to
explain D const or bash C++ const? Why fight C++?
> I must agree here. Not only about const, but the page always seems to
> explain D by comparing it to C by saying "In C you used to do this, but
> in D you can do it better like this".

There are a few pages like this.  The wordcount/performance page, for
example.  I've never really liked them.  It's one thing to explain how D
features are different from the features in other languages to avoid
confusion, but another to talk about the problems in other languages
and how D improves on them.  It makes D seem like the Democratic
Party of the programming world.

> I know D is mostly targeted at people with C++ knowledge. *mostly*. It
> would be nice if D was presented as a new, clean language, with complete
> explanations and some minor sections comparing it to other languages
> (and not always C++). It would say, after some good explanation, "If you
> are familiar with C++, this concept maps to...". That way, people that
> don't know C++ won't get scared if they see D, or feel the need to learn
> C++ before D.

This is why I don't like some of the decisions in D 2.0.  Choosing 'enum',
for example, to represent manifest constants.  It takes a necessary hack
from C (declaring constants as enum values because it's either that or
#define and #define stinks) and formalizes it as the Right Way to declare
manifest constants.  Personally, I think that anonymous enums shouldn't
be allowed at all--formalizing the approach is a disaster.  I guess what
I'm saying is that I simply don't accept the argument that D should
support C syntax, even bad C syntax, simply in hopes that it will help
gain acceptance from the C community.  Support for C-style function
pointer declarations is another one that should go.

> Imagine you enter the Java page and you read "Well... in C++ you have
> pointers, in Java you don't. Java only keeps the classes, but with this
> syntax. etc." No! Java is a completely new language, with another
> perspective in mind. And I think the same about D.
> People might also think "Bah, a new effort to write an improved C++".
> Instead, they should think "This language is great, I can do a lot of
> things, even all of those I could do with C++, and much more easly!".
> Same as Dee Girl, no offense intended.

"Me too."


Sean



More information about the Digitalmars-d mailing list