On Friday, Nov 23rd 2007 at 14:53 -0000, quoth Jerrad Pierce:

=>>I admit I'm better with python these days than I am with perl, but one of
=>>the caveats that the dispatch table should be taught with is that
=>>selecting the correct code ref is different from calling through it.
=>
=>You might want to explain yourself in fuller, properly punctuated, 
=>detail there (particularly since it seems to not be about hashes per se)

Sorry, I thought I was clear and properly punctuated.

Given:
        table = { ... }

eg
        ref = table{ expr }
        ref()

is different from
        table{expr}()

The latter can be a bear to debug ;-)

In the second case, you're calling a function which can produce any error 
that all of the functions in table are capable of generating. This may 
also include an illegal reference into table in the first place. In the 
first example, you eliminate the indexing into the dispatch table as a 
seperate step from actually making a subroutine call.

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net

Reply via email to