[Chicago-talk] Dynamic method call
pbaker at where2getit.com
Fri Nov 7 14:24:30 CST 2003
On Nov 7, 2003, at 2:24 PM, Steven Lembark wrote:
> For one rather nice way: perldoc Class::Contract;
That's for OO where prototypes don't matter anyway.
> The manual checks are my preference only becuase I can give
> more useful error messages than the compiler does. In most
> cases with perl the arg's are on a list or a referent to some
> type. Aside from knowing to pass in a hash referent (vs array
> ref) or that arg's are required, the really useful error
> messages don't start until after the values themselves have
> been validated, which prototypes cannot do for you. Once
> you have to validate the arg's anyway, what's the difference
> in adding 2-3 lines to check for a correct ref type?
Which brings me to the point. When I'm doing complex things, I
generally go with OO so prototypes are a non issue and I'm doing manual
more complex checks anyway.
But when doing functions that are taking general not-too-complex
arguments, where you may only ever screw up by not giving the right
number of them, that's when I use prototypes.
"Yes, we did produce a near-perfect republic. But will they keep it? Or
will they, in the enjoyment of plenty, lose the memory of freedom?”
-- Thomas Jefferson in a letter to John Adams
GPG Key: http://homepage.mac.com/pauljbaker/public.asc
More information about the Chicago-talk