#5 Instance slots access is not coherent

Cleanup
closed-fixed
Annoyances (7)
2
2004-08-01
2004-07-31
Francesco Garosi
No

As of version 1.0 of PyCLIPS, there are two functions to
access slots in an Instance objects, that is the
SlotValue ("getter") and PutSlot ("setter") methods. This
is not coherent with what happens with Fact objects for
instance, where a dict-like Slots attribute is provided,
giving access to fact slots both for assignment and
retrieval. Such a feature is desirable in Instance objects
as well, in order to have more readable and coherent
code.

However, also the choosen names for the getter/setter
functions are not the best choice: they differ so much
that they look unrelated, so that code accessing
Instance slots results difficult to read. Thus, in every
case, it could be necessary to rename one of the
two "accessors" in a way that allows code to be more
coherent (e.g. PutSlot/GetSlot or
GetSlotValue/SetSlotValue).

Current attributes should be retained at least until the
first stable release (1.1), then they can be deprecated
in 1.2 and eventually removed in a subsequent stable
release.

Discussion

    • status: open --> open-fixed
     
  • Logged In: YES
    user_id=328337

    The names have been changed, and now the "official" names
    are GetSlot/PutSlot; also, the Slots dict-like property (as in
    the Fact class) has been added. However no deprecation
    warning is issued if slots are accessed via getter/setter
    functions. The old names have been retained (an extra
    SetSlotValue has been added as synonym for PutSlot just for
    coherence). Documentation has been updated accordingly.

     
    • status: open-fixed --> closed-fixed