documentation and papers about const/invariant

Ary Borenszweig ary at esperanto.org.ar
Tue May 20 08:29:45 PDT 2008


Sean Kelly wrote:
> == Quote from Ary Borenszweig (ary at esperanto.org.ar)'s article
>> 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.

Exactly. Walter's reason is that makes it easier for porting C/C++ 
applications to D. Isn't it much easier to make a bridge to those 
languages instead of expecting the user to port a whole application from 
C/C++ to D? Also, even if syntax is kept the same, D's semantics are 
already different (so keep the semantic, then keep C/C++?), so I don't 
see the benefit of conserving old, obscure syntax.

For example Java allows you to write "int foo[];" instead of "int[] 
foo;", just to make C/C++ programmers feel a little more comfortable. 
And still, I haven't known a Java programmer that declares arrays that 
way, and probably when you teach Java to someone that knows C/C++ you'd 
say "See? The type is in one place, the name is in the other, much 
clearer!" :-)



More information about the Digitalmars-d mailing list