On 15 Feb 2017, at 10:56, Ben Coman <btc@openinworld.com> wrote:
On Wed, Feb 15, 2017 at 3:38 PM, Alistair Grant <akgrant0710@gmail.com> wrote:
I'm developing a number of classes where it would be convenient to be
able to inspect what might be described as calculated attributes, i.e.
the result of a unary message send. The result isn't stored in an
instance variable, but is still useful when inspecting.
I can obviously develop an inspector extension for my application, but
was wondering if there is a framework in place that allows a list of
attributes to be declared that can also be inspected in a similar
fashion to normal instance variables.
Many thanks to Doru and everyone who has contributed to the GT Inspector
framework. It has significantly influenced my development and the
architecture of the software I'm currently working on (in a positive
way, of course).
Would it be feasible to have a "CalculationSlot"
that was read only, and each time it was read it performed the calculation?
Using a ���virtual��� slot would be possible��� it would look like a instance variable,
(you can read from it and the calculation is done).
I added this as an example to the Slot package:
Changes:
- Name is ���ComputedSlot���
- added #= and #hash so changing the block is possible in the class definition
- do not raise error but ignore writes to not interfere with object migration done by
the class builder (e.g. when adding an ivar).
I will add that as an example to the image.
Marcus