Suggestion: new switch statement

Stewart Gordon smjg_1998 at yahoo.com
Fri Aug 25 03:01:50 PDT 2006


mike wrote:
> Hi!
> 
> If I may comment on that - I think that fits perfectly into the syntax. 
> Think of that:
> 
> ' class foo
> ' {
> '     // you can write public in 3 different ways
> '     public int x;
> '     public
> '     {
> '         int y;
> '     }
> '     public:
> '         int z;
> ' }
> 
> Why not something similar with switch?
> 
> ' switch (i)
> ' {
> '     // you could write case in 3 different ways too
> '     case 1 writefln("case 1");
<snip>

Allowing {} to be omitted would create parsing ambiguities.

     case qwert (yuiop) (asdfg());

Is this equivalent to

     case qwert:
         yuiop(asdfg());
         break;

or

     case qwert(yuiop):
         asdfg();
         break;

?

Stewart.

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS- 
PE- Y? PGP- t- 5? X? R b DI? D G e++++ h-- r-- !y
------END GEEK CODE BLOCK------

My e-mail is valid but not my primary mailbox.  Please keep replies on 
the 'group where everyone may benefit.



More information about the Digitalmars-d mailing list