[OT] best way to determine existence of a function in a package

chromatic chromatic at wgz.org
Mon Nov 19 22:57:59 GMT 2007

On Monday 19 November 2007 14:21:06 Tim Sweetman wrote:

> How about
> Local->can("function")
> That'll work, I think, and, as far as I can see, should keep everyone
> happy.

I don't think that meets Dirk's original goal though, which is "Does this 
function exist in this package?"  can() is a method (which means that you are 
in a state of sin if you use it as a function) but it also works on methods, 
so it answers the question "Is there a method of this name defined in this 
class or any of its parents?"

The use of the word "function" makes me think that inheritance is not a 
desirable property here, so even when using can() as a method, I'm not sure 
it'll answer the question appropriately.

-- c

More information about the london.pm mailing list