
The Highest-Level Feature of C - jessaustin
http://prog21.dadgum.com/166.html
======
vog
I think that "switch" doesn't name the feature properly. It's more about
"pattern matching" as defined by functional languages such as Haskell or
OCaml:

[http://caml.inria.fr/pub/docs/oreilly-book/html/book-
ora016....](http://caml.inria.fr/pub/docs/oreilly-book/html/book-ora016.html)

This enables you to match any nested enum/tuple/list/tree structures, and have
the compiler check that you didn't forget a case. The modern compilers can
even give you an exact example of a case you forgot to specify.

Compared to those possibilities, the high-praised polymorphism of OO languages
appears to be little more than simple dispatching. (At least for simple OO
languages. There are also very powerful and expressive object systems such as
CLOS.)

------
jessaustin
Here I thought "switch" was just a parametric "goto". I only use it without
"break". If you need "break" forget "switch" and just use "else if"'s as they
are safer.

