On 2008-12-31 18:22:32 -0500, "Adam D. Ruppe" <destructiona...@gmail.com> said:

This wouldn't be any less efficient than any other switch statement; writing

case 2..5:
  code;
  break;

could just be magically converted into

case 2:
case 3:
case 4:
case 5:
  code;
  break;

Except that if you want to keep consistency with array slices, 2..5 should probably not include 5 in the range, thus should be equivalent "case 2,3,4". Unfortunatly, that's generally not what you want when creating such cases. Imagine writting:

        case 'a'..'{':
        case 'A'..'[':

Concistent, yes; but not very appealing. What you want to be able to write is this:

        case 'a'..'z':
        case 'A'..'Z':

But then it doesn't work as elsewhere in the language anymore.

--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to