MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

verbing properties (Bb's call)



I'm not sure that the recently-discussed plan for `verbing properties'
is a good one; it seems awkward and some of it indicates a lack of
understanding of MOO.

But this seems a good opportunity to spin out another entry from my
`wish list':

  function property_value(OBJ object, STR property-name)
  Returns <object>.<property-name>, if it exists and is readable
  with the programmer's permissions, else returns E_PERM or
  E_PROPNF or E_INVIND as appropriate.  Handles built-in properties
  the same way as in-DB properties, taking $server_options into
  account as relevant.

  function set_property_value(OBJ object, STR property-name, value)
  Sets <object>.<property-name> to <value>, if it exists and is
  writable with the programmer's permissions, else returns E_PERM
  or E_PROPNF or E_INVIND as appropriate.  Handles built-in 
  properties intelligently.  (Yes, by setting obj.prop to a false
  value this function will return a false value; that's up to the
  programmer to verify.  In general checking for equality to <value>
  should suffice as an error check.)

  For all verbcode references of the form
    <object>.<property-name> = <value>
  the server will silently, and without modifying the user's verb
  code, call set_property_value and raise/return the response.

  Similarly, for all references to
    <object>.<property-name>
  which attempt to access the property's value, the server will
  silently call property_value.

Why do I want this invisible indirection?  Because it's invaluable to
applications which want to extend the server's functionality in weird
ways.  For example, OpalMOO has multiple ownership fully integrated, and
verb wrappers can be used in 1.8 to make every aspect of it seamless,
-except-for-property-access-.  By having property access be controllable
by builtin (by setting thse builtins to be protected, this forcing a
wrapper on #0), this final hassle can be dealt with.

I'm not going to go on at any greater length, 'cause I know this isn't
going to get implemented, but I figured I'd toss it out.  I think a lot
of property-access questions could be dealt with in this manner.

Seth / Blackbriar

--
----------------------------------------------------------------------
Seth I. Rich - sir@po.cwru.edu - http://corporate.hygnet.com/~seth/
                                 There is nothing more precious than
Rabbits on walls, no problem.    a tear of true repentance.



Home | Subject Index | Thread Index