Is anyone using Pragmas in 3.9 to do Magritte
descriptions? If so,
are
there any samples anywhere?
Yes, it is doable and there was an implementation some time ago in
the Magritte-Model package. The class was called MAPragmaBuilder a
subclass of MADescriptionBuilder.
- The reason that there were no examples was because code using
Pragmas cannot be loaded into 3.7 and 3.8 images, and we still have a
few of those that work with the latest version of Magritte. I know
that others are using Magritte with older Squeak versions as well.
- Therefor I removed MAPragmaBuilder from Magritte-Model, in one of
the latest cleaning efforts as it was never used ... now that you
ask, it might have been the wrong decision. You can reload it by
browsing the code of Magritte-Model-lr.228 and load the class. To
activate it you need to evaluate:
MADescriptionBuilder default: MAPragmaBuilder new
Then you can put your descriptions in a method like:
Address class>>street
<description>
^ MAStringDescription selector: #street
You can use class extensions to extend existing descriptions from a
different package:
Address class>>streetAddendum: aDescription
<description: #street>
^ aDescription beReadonly
It doesn't matter much for speed. And this implementation is
conceptually very close to the naming convention.
PS: I think it would be better to actually put the descriptions into
accessors (move them to to instance-side), but this means to change a
few others things and I didn't find the time to do that yet.
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch