A switch/case too far...
Mike James
deepc at fishing.net
Tue May 20 04:06:38 PDT 2008
I was looking thru some DWT examples and there is plenty of code like this...
if (myObj is thisObj)
// do something
else if (myObj is thatObj)
// do something else
else ...
It occured to me how much neater it would be if the there was a switch/case construct that could deal with it..
switch (myObj) {
case thisObj:
// do something
break;
case thatObj:
// do something else
break;
default:
// do nothing
}
I'm not sure how much compiler 'magic' would be required :-)
More information about the Digitalmars-d
mailing list