request switch statement with common block

JS js.mdnq at gmail.com
Sat Aug 3 11:56:44 PDT 2013


On Saturday, 3 August 2013 at 17:45:11 UTC, w0rp wrote:
> I can see you saving a little bit of typing with this, but it's
> not worth it.


Um, it can actually save a lot of type and errors.

having two places to change is very error prone.

if (cond) { }
switch(cond)

If the condition is complex and one forgets it is the same 
condition then only changing one block will cause bugs.

It is not a hard feature to have AND it is worth it because it is 
a near zero complex compiler implementation.

So, depending on how you define "not worth it", which I take "I'm 
too lazy to implement it", you could be correct.



More information about the Digitalmars-d mailing list