
proto Package FAQ

1. What scope do unqualified object references within methods use?

A proto object is an environment and the defined methods in a proto object have
that environment as their parent.  Thus unqualified object references
within a proto method look first in the method itself and secondly in the
proto object in which they are defined.  This is referred to as object
scope as opposed to lexical scope or dynamic scope.  It allows simple 
situations where delegation is not used to use unqualified names.  Thus 
simple situations remain simple.  Also read 

http://hhbio.wasser.tu-dresden.de/projects/proto/prototype_approaches.pdf

about the fragile base class problem for additional information that
relates to this question.


2. Why does obj$meth not return the method, meth?

obj$meth(x, y) needs to call meth(obj, x, y) so obj$meth needs to
return meth with its first argument, obj, already inserted.  Since
calling a method is the most common operation that operation was made
the simplest. To get the method itself use with(obj, meth)


3. How does one debug a method?

proto will not dynamically redefine methods.  This has the advantage
that debug can be used.  Be sure you are referring to the method itself
and not a call to the method:

   with(obj, debug(meth))

and not 

   debug(obj$meth) # wrong!


4. Is multiple inheritance supported?

No. proto is just a thin layer on top of R environments and R environments
provide single inheritance only.  Note that:

http://hhbio.wasser.tu-dresden.de/projects/proto/prototype_approaches.pdf

discusses some ways of handling situations which would otherwise require
multiple inheritance.


5. How does one document proto methods.

One can use an R .Rd file together with \alias entries.
