new DIP5: Properties 2

bearophile bearophileHUGS at lycos.com
Tue Jul 28 12:01:20 PDT 2009


Bill Baxter:
> Switch is a monstrosity pretty much any way you look at it.  Sh had the right
> idea there.  Is "case" really necessary there?  Some syntax should
> suffice I would thing.  And "default" is probably the world's most
> useless keyword.  Why not "else:" or "*:" instead of introducing a
> whole new keyword?

Case of Pascal is better (2 keywords where "of" isn't that useful, begin-end are optional if you want more than one instruction, Pascal isn't case-sensitive):

Case X of
  1: Begin
        ...
      End;
  2 .. 10: Begin
        ...
      End;
  ...
  Else Begin
         ...
       End;
End; {CASE}

But D is backward compatible with C (unlike languages like Scala, that eventually D will need to take a look at), so this is an academic topic.

Bye,
bearophile



More information about the Digitalmars-d mailing list