MOO-cows Mailing List Archive

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

Re: verbing properties (Bb's call)



This is from a while back . . .
--- Seth I. Rich wrote:
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.
--- end of quoted material ---

If you want this, Patrick and I already have property_full() and 
set_property_full implemented, tested, and working.  A few minor
modifications on your part to eliminate the permissions and owner
returns will turn it into what you are looking for (they even 
handle built-ins)
As for the other thing, we will finish the modifications to execute.c 
to replace obj.prop = quack with obj:_set_prop(quack) and obj.prop
with obj:_get_prop().  It would probably be pretty easy to change
this to what you want.

-manta



Home | Subject Index | Thread Index