request switch statement with common block

Andre Artus andre.artus at gmail.com
Sat Aug 3 12:10:18 PDT 2013


On Saturday, 3 August 2013 at 18:56:47 UTC, JS wrote:
> 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.

If the implementation is so obviously trivial why don't you 
implement a proof of concept? The compiler is open source after 
all.

People routinely underestimate the ripple effect that adding 
'trivial' extensions to a language can have on a language.


More information about the Digitalmars-d mailing list