john boris <jbori...@gmail.com> wrote:
> I know I should use Switch

Brandon Allbery replied:
> Actually Switch is considered rather bad.

Paul Graydon asked:
> I don't think I've heard that before.. why is switch considered bad? In
> most languages it is supposed to be far more efficient than a nested if
> statement.

I don't know Brandon Allbery's reasons for saying "Switch is . . . bad"
but I do know this: Perl 5 does not have "switch" as a native statement
in the language; "Switch" (note the capitol "S") is a Perl module that
extends the language. If I had to guess at Brandon's reasons it would be
that the module is implmented poorly.

Whether switch is more efficient than nested if statements is a language
implementation question; whether it's easier for humans to understand is
a religious debate; in either case, the issue here is (I believe) the
lack of a switch statement as a native part of the language.

Adam
_______________________________________________
Tech mailing list
Tech@lists.lopsa.org
https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech
This list provided by the League of Professional System Administrators
 http://lopsa.org/

Reply via email to