shouting versus dotting

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Oct 6 09:55:07 PDT 2008


Steven Schveighoffer wrote:
> "Andrei Alexandrescu" wrote
>> Well would you go on a strike if there was a little experimentation with 
>> the curls?
> 
> I like D too much to give it up based on this one thing.  But I would be 
> cursing you profusely as I changed all my existing D code when I move to 
> support D2.  I don't think I'd ever feel that it was an improvement, but if 
> it means so much to everyone to abolish the ! syntax, I'd just do the 
> updates and move on.  Like I said, it's a bicycle shed color.
> 
> BTW, this would be another notch in the D1/D2 incompatibility belt (perhaps 
> an insurmountable one), but that ship may have already sailed.

There's no need to worry about it at all. The !() syntax can stay for a 
long time in vigor as an alternative that gets used less and less, then 
mentioned less and less, until essentially disabling it becomes a 
non-event. PL history has many examples of such changes that were 
successful, and I'll give a few:

1. The K&R function declaration syntax:

int foo(a)
     int a;
{
     return a;
}

Before trying: do you believe gcc would accept it? How many of us wrote 
one like that?

2. C++'s member function definition:

class A { void foo(); }
void A.foo() {}

3. Perl, having a very experimental attitude towards syntax, has 
effectively "forgot" quite a few syntaxes that weren't successful, but 
remained harmless. For example, "?pattern?" is equivalent with the 
well-known "/pattern/", and still accepted - yet hardly anyone uses it 
anymore. (There was IIRC an odd operator for accessing a package member 
that also fell into obsolescence, incidentally it might have been "!", 
does anyone know?)

Of course it's ineffective to allow a lot of things and then leave them 
hanging around, but it is possible to operate a syntax change without 
too much disruption.


Andrei



More information about the Digitalmars-d mailing list