On Fri, 2009-06-26 at 11:27 +0200, Lukas Renggli wrote:
> I'm toying around with MAPluggableAccessor. While I really
> to introduce some kind of delegated descriptions it doesn't
> work that easy. I'm not really familiar with caching of the
> magritte descriptions. My problem is that I'm operating on
> a MAContainerComponent using childAt: .
I don't have such a method.
Really? If this since ages and it seems to be your code :)
^ children at: aDescription ifAbsent: [ nil ]
I'm using gemstone but I had this method in my old squeak installation
> The children are
> detected by =. The MAPluggableAccessor implements equality based
> on the equality of the read and write accessors. But these are
> blocks and return false if compared.
Indeed, identity of descriptions is currently established with the accessors.
The whole identity thing is problematic and caused some lengthy
discussion dating back to ESUG 2006 in Brussels. At the time I started
with Magritte the accessor seemed to be a decent choice, however later
it became clear that it does not work well for accessors like the
MAPluggableAccessor or MANullAccessor.
Today I think the identity should be established using a special
object, by default it would just use the identity of the description.
If the developer provided an UUID in the code it would use that
instead. Although such an approach does not sound very OO, it is
probably the only way to ensure object identity even if the
description changes completely (including the accessor and the class)
or when identity has to be preserved across multiple images.
> So I'm wondering what is the intended of the class. I can get
> it to work if I'm caching the accessor inside the component.
> But maybe it is supposed to work different.
I don't understand the above part.
I was just wondering if I try to use the MAPluggableAccessor the
wrong way and hence facing problems. I can do
^ accessor ifNil: [
accessor := (MAPluggableAccessor
write: [:model :object| ]) ]
accessor: self accessor
This way I get it running but I don't like it much. I don't know exactly
what MANamedBuilder is caching. I just thought it might solve the
problem by caching the instances.