Re: New Switch Idea
- Posted by mattlewis (admin) Mar 28, 2009
- 1110 views
Why say with or without fallthru when you could say without or with break?
switch without break -- default C like switch current behavior switch with break -- BASIC select like behavior: automatically put breaks in before each case
Equivalent to the current idea except you don't introduce yet another keyword.
To me, with/without break is confusing. without break. Does that mean the switch statement does not automatically insert breaks for me? or does it mean that I can do the switch without breaks (i.e. me not inserting a break).
The term for the behavior we are toggling is fall thru. with fallthru and without fallthru is clear and there is no mistaking it.
Yes, I agree, but I think the with statement should be mandatory. Also, I'm not sure I follow the discussion regarding do. People have said that it's used for while in order to be a separator, but this isn't really true. IIRC, we put do in the switch construct to keep it consistent with other euphoria paradigms. We always have a do or then to start a code block.
I think that we should keep this consistent with switch. I'm not against using some other word, but I think we should have something there.
Matt