"with" still sucks + removing features + adding features

Jason House jason.james.house at gmail.com
Mon May 18 14:42:12 PDT 2009


Andrei Alexandrescu Wrote:

> Jarrett Billingsley wrote:
> > On Mon, May 18, 2009 at 1:46 PM, Andrei Alexandrescu
> > <SeeWebsiteForEmail at erdani.org> wrote:
> > 
> >> Final switch works with enums and forces you to handle each and every value
> >> of the enum. Regular switch gets ranged cases by the syntax case a: .. case
> >> b: (I've always thought switch would be greatly helped by that).
> > 
> > Kind of an odd syntax.  Why not "case a .. b:"?  Parsing issues?
> 
> It's consistency. Everywhere in the language a .. b implies b is 
> excluded. In a switch you want to include b. So I reflected that in the 
> syntax. In fact, I confess I'm more proud than I should be about that 
> little detail.

Consistency???

While I can see where you're coming from, I still see plenty of inconsistencies. It's still a range (defined with .. too). Having slices and foreach use syntax a and meaning 1 but switch using syntax a' and meaning 2 kind of sucks. 
 
 
> >> Static foreach might be making it too.
> > 
> > That'd be a nice addition.  Especially with __traits returning
> > arrays/tuples, it'd be an alternative to CTFE (shudder) or template
> > recursion.
> 
> Yah, can't wait.

I'm still hoping for static switch too!



More information about the Digitalmars-d mailing list