On Sun, Aug 31, 2008 at 11:02:17AM -0700, Gus Wirth wrote:

In this context a function is something that can be called from anywhere
in the program; it just exists "out there" to be used by anything. A
local method is a function that belongs to the object; only code in the
object can call the local method, other code outside the object doesn't
know about it.

There are different ideas about what a method is and the ideas
strongly effect the language design.

The most prevelant notion is that a method has a hidden argument that
represents the object.  The partulcar fuction that is called depends
on that object instance that is referenced.

Other languages, such as Common Lisp and Ada make the object argument
explicit.  This has an advantage that the object system can dispatch
on more than one argument, which maps better to some problems.

Others are somewhere in between.  Python uses a hidden argument, but
the methods can also be called explicitly by naming the argument.  Ada
2005 allows for the dot '.' notation for a hidden argument that is
explicitly declared in the declaration of the function/procedure, but
need not be specified in the call.

David


--
KPLUG-List@kernel-panic.org
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to