On Fri, Oct 04, 2002 at 04:42:27PM -0700, Michael Lazzaro wrote:

> [Draft Proposal: Symmetry between Attributes and Accessors]
> 
> It is proposed that class attributes may be treated as functionally 
> equivalent to an identically named accessor method.  In this manner, it 
> shall become irrelevant to callers whether a public attribute of an 
> object is implemented as an attribute, or an lvalue method.

Excellent.  When Chip was starting Topaz a lot of implementation
languages were suggested.  Eiffel seemed to have a lot going for it, and
this was one of its features that I really liked.

The argument, of course, is that the implementation is, well, just an
implementation detail and that exposing it to the class user breaks
encapsulation.

> [CONS]
> 
> - Making publicly accessible attributes at all is considered Bad Form 
> in most OO methodologies, which advocate the use of explicit accessor 
> methods.  We may wish to discourage or even prohibit the behavior.

If, as a class user, you can't (easily) tell the difference between a
method call and an attribute, I don't see any problem.

> - An attribute and a method are _not_ typically implemented in the same 
> manner.  Treating the two as interchangeable might imply runtime 
> overhead.

Bah!  I bet the internals list will laugh at you :-)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

Reply via email to