what and how are MAProxyObject and MADynamicObject
used in magritte ?
i know it acts as a proxy for a 'real Object'. where are these
proxies used
?
It is rarely used, I try to avoid its use as much as possible.
MAProxyObject is an abstract class. MADynamicObject is created when
sending the message #asDynamicObject to a block.
The idea is to have dynamic properties in descriptions (or other
objects). For example in Pier the owner of a structure is described
on the class side with something like:
MASingleOptionDescription new
beSorted;
label: 'Owner';
selectorAccessor: #owner;
reference: PUUser description;
options: [ self allUsers ] asDynamicObject;
yourself
This means every time the options are queried the sender gets a proxy
object that (most of the time) resolves to the list of all available
users.
Again, this is cool magic that works most of the time, but I strongly
discourage to use it. In all cases it is possible to avoid its use
all-together, for example by overriding #description on the instance
side and adding the description manually instead of defining it on
the class side. I am just too lazy to do that sometimes ;-)
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch