After reading S12<v58>, I have many many notes about things that need to
be tightened up or places that open more questions then provide answers.
But, a lot of it boils down to a core set of issues. Can y'all explain
these to me? Help me see the core concepts, and I can work out the
details and submit draft text back for review. So consider answering
this for me well as an investment <g>.
A method can refer to private attributes etc. in other objects than
self. This is unlike Smalltalk and like C++. Which objects?
Obviously, those that _have_ them in the first place. Does the variable
used as the invocant, or return value if it is an expression, have to be
statically typed as being of the identical class? Or does it apply that
constraint implicitly at run-time? If the former, note that in C++ it
must be the identical class, NOT a derived class, even though that is
simple to work around, because that is a conceptual point.
If class C { has $.a; ... }, then I understand that members may refer to
$.a directly but outside of the scope of members defined in the class
they can only be reached by accessors, a() as a method call.
But, it is also stated that in derived and trusted classes, and even in
the class itself, $.a is an accessor call? As opposed to $!a which is
the direct access to the attribute. Is this accessor different from the
function form used outside the class? Why keep the variable syntax?
I'm getting a picture of 3 forms of access: Really direct, direct but
asking the class to access it rather than knowing how storage works, and
indirect that may involve your own code to do other things besides just
get/set the attribute. But I think the middle one can be handled
invisibly by the compiler -- it's no different from a tied hash.
How private is private? I wonder if what you've called private things
are really more like "protected" in C++ (accessible by the derived
class) and that 'my' attributes are really private, as are submethods.
It's all confused. Who is allowed to access what?
Meanwhile, I'm concerned about lvalue subs as rw accessors, but I'll
table that for now.
--John
- Conceptual questions about Objects John M. Dlugosz
-