When editing a structure, accessors are called via
Magritte but there
is no way for the structure to reinitialize itself before any accessor
is called, or to re-establish its invariant after all accessors have
been called.
It is possible to create a subclass of PREditCommand and override
#doExecute to trigger some postprocessing.
I thought I'd wrap PRCommand>>doExecute with
something like self
structure willEdit and self structure didEdit, would that make sense?
Exactly.
I think writing this helped me see a solution:
- validation does the heavy parsing and stores result in (an adhoc
subclass of) the edit command
- executing the command stores parsed data in the structure and resets
the final data
- a lazy accessor for the final data builds it and ditches the
parsed data
hopefully that was clear… if you have suggestions…
Generally getting notified about events is a bit of a problem in Pier.
Several things (such as creating new structures, persistency, etc) are
quite, because this triggers events in rather clumsy ways. I once
rewrote part of this mess using announcements, which provides a
significant improvement over the current status but also breaks/
changes certain things. Unfortunately I lost the image, but if I have
time I probably redo it.
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch