Subject: Re: Encapsulation

From: [email-masked] (Christopher Bloom)
Date: Sun, 21 Nov 1993 13:35:25 -0800

At  1:12 PM 11/21/93 -0800, Erik Ostrom wrote:
>> The current permissions systems are all about security, they do not have
>> anything to do with flexibility.  And the flexibility we are looking for
>> here is the extra level of abstraction provided by the verbs or "getters"
>> as they are called in some other object oriented languages.
>
>@prop foo.bar 0 ""
>
>If a property has none of the r, w, and c bits set, is readable and
>writable only by the owner of the object on which it is defined.  The
>object should then define getters and setters for manipulation of the
>property.
>
>It would be better if this (the !c part, at least) were default.  It
>would probably be better if it were mandatory and there were no
>permissions bits.  It would be better if access were limited to the
>object defining the property, rather than that object's owner.
>
>You do, however, have significant flexibility.
>
You write as if getters and setters are already a part of the language.  I
was under the impression that it was just an idea that was being discussed.
  Maybe I am out of context.

>>                                                             And I too
>> believe that it could put a serious dent in the number of MOO server
>> crashes.
>
>I'm curious--what leads you to this belief?

The ability to define getters and setters is all by itself: nothing.  But
the proper use of them can protect an object from improper use by others by
providing a layer of code in between which can check in the case of setters
to make sure that the value being used to to assign to an attribute is of
the right type, in a range, is one of a list of allowed values, etc.    And
in the case of getters there are things that can be done to ensure that the
value being handed out should be handed out, is initialized, is in the
proper state, knows it is being handed out, etc.   So, these things may not
directly save the server from crashing, but indirectly it provides a level
of meta-"typechecking" (for lack of a better term) whose worth cannot be
denied.
-------------------------------------------------------------------------------
 Christopher Barkley Bloom              (415)966-6290
General Magic                                       [email-masked]
CyberLife Enthusiast
----------------------------------------------------------------------------
--