when to use generic methods as opposed to "regular" pocedures

From: Brian Denheyer <briand_at_northwest.com>
Date: Thu, 1 Oct 1998 19:34:01 -0700 (PDT)

I have developed a habit of making anything which takes an argument
which is a class a generic method. It then occured to me that a
"regular" procedure is likely to be faster since there is no method
look-up.

I then realized that this may not be true depending on how method and
procedures are implemented, i.e. maybe "regular" procedures are
implemented as special case generic functions and therefore there is a
look-up cost associated with them anyways.

So the question is, when should a method be used vs a regular
procedure definition, when either can be used ? Is it really more
expensive to use a method vs. a procedure ?

I am probably going to start using the rule that functions which do
not need to be "overloaded" will be implemented using a "regular"
procedure.

The only other consideration is that using methods can provide a sort
of type checking since you'll get an error if the args don't match-up,
but I find that this is does not accur so often that it would really
help me that much.

Any comments ?

Thanks

Brian

-- 
Brian Denheyer
briand_at_northwest.com
Received on Wed Oct 21 1998 - 07:11:37 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST