The Wrong Stuff
Jonathan M Davis
jmdavisProg at gmx.com
Fri Sep 24 09:51:57 PDT 2010
On Friday, September 24, 2010 08:56:22 lurker wrote:
> Andrei Alexandrescu Wrote:
> > On 9/23/10 22:59 CDT, Walter Bright wrote:
> > > Jonathan M Davis wrote:
> > >> I don't really mind it how it is, but I've known plenty of programmers
> > >> who hated the fallthrough behavior in other languages. So, it would
> > >> likely be a good change to make.
> > >
> > > I'm probably alone in this, but I've always liked the C behavior and
> > > never had a problem with it. It's probably from my asm days, as it
> > > works just like labeled asm statements do.
> >
> > Well admitting you're alone in this is the first step to recovery :o).
> >
> > Andrei
>
> He's not alone with his view. The automatic implicit porting of C code is
> an important feature - D should work even more like C than it does now.
> The syntax could also make use of a revamp, we have 'pure' and 'const' and
> so forth, in C those are __attribute__((pure)) and similar kind of
> conventions. The C approach saves keywords for actual code.
I don't think that it's ever been the case that we've been all that worried
about making C code portable with minimal effort. We just don't want to make it
harder without added value. Really, choices with regards to changes from C or
C++ come down to two things:
1. Changes aren't made without value being added.
2. When C and D are the same, the semantics are the same so that ported code
doesn't change behavior.
And really, stuff like __attribute((pure)) wouldn't be standard C anyway. There
is no pure, nothrow, etc. in C, and such features were added to D in the manner
that seemed best to Walter and Andrei and company. Since C doesn't have those
features, there is no conflict with C. And even if there were, if the changes are
deemed to be of great enough benefit, then making them is fine because they don't
result in C code ending up with different semantics when it's ported over.
Personally, I don't think that it should be D's goal to be like C. It shouldn't
change things willy-nilly or make it so that C code would have different
semantics as D code, but the lack of direct backwards compatability with C is a
*feature* of D. And as for keywords, while we don't want to go overboard adding
new ones, considering how many words there are in the English language and how
programmers tend to use altered and abbreviated versions of them anyhow, even
doubling the number of keywords that we have now wouldn't ultimately be that big
a deal. Sure, it would be annoying at times, and you'd have to search for
synonyms and the like, but it wouldn't be all that restrictive ultimately.
However, we're not going to double the number of keywords that we have, and the
@ syntax has allowed us to remove some keywords and will allow us to add more
stuff later without having to add keywords.
In any case, I think that on the whole, D has taken the right approach here.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list