On Thu, Feb 19, 2004 at 10:46:33PM -0000, Rob Dixon wrote:
> <[EMAIL PROTECTED]> wrote:
> >
> > The Advantage is you get to use the switch statement. The disadvantage is
> > your code will run extraordinarily slow because the Switch module uses a run time
> > Filter. In short: isn't an is-elsif-else statement enough??
> 
> Are you saying that 'if-elsif-else' is a compile-time filter? It isn't.
> So I guess 'if-elsif-else' runs extraordinarily slow too.
> 
> AFAIK Switch allows coding that runs no more slowly than 'if', and lets
> you express some solutions much more neatly.

The problem is that Switch.pm is a source filter, which is effectively
an extra level of processing before compilation.

Personally, I wouldn't use a source filter for anything I cared about.

The docs for Switch state:

  There are undoubtedly serious bugs lurking somewhere in code this
  funky :-)

and also

  Due to the heuristic nature of Switch.pm's source parsing, the
  presence of regexes specified with raw "?...?" delimiters may cause
  mysterious errors.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to