2017-10-03 16:15 GMT+02:00 Sean P. DeNigris <s...@clipperadams.com>:

> Denis Kudriashov wrote
> > I thought I explained it in my blog... But I know that I am a bad writer.
>
> Ah, sorry I forgot to re-read the blog and was trying to refresh my
> understanding just based on this thread. I wouldn't say the post was poorly
> written, just seemed to assume a prior familiarity with the inherent value
> of class annotations.
>
> From what I understand, what you're describing sounds very Magritte-like.
>

Yes, Margitte class side descriptions can be implemented as
ClassAnnotations.


> What I don't understand is the difference between, for example:
>
>     CmdCommand class>>#activators ^ self classAnnotations select: [ :each |
> each isKindOf: CmdCommandActivationStrategy ]
>

In Commander we need to query all activation strategies which are defined
for particular Command. So here we skip any other annotations.
But the common case is to query all instances of concrete kind of
activation strategy. For example to find shortcut for given keymap:

CmdShortcutCommandActivation allAvailableInContext: aToolContext do:
[:eachShortcutStrategy |

eachShortcutStrategy keyCombination matches: aKey ]



> and a <commandActivationStrategy> pragma which signifies a message
> returning
> an appropriate object.
>

I also thought that I explained it in the blog :).
If you will use method pragma then you will repeat logic of this library:
In your code you will need evaluate found pragma methods. You will need to
handle broken methods. You will need to implement inheritance, how to
correctly query overrides.
And if performance is important you will need to implement kind of cache
and invalidation logic.

So ClassAnnotation solves these problems.
All annotations are cached and cheap for queries:

CmdShortcutCommandActivation registeredInstances ==
CmdShortcutCommandActivation registeredInstances.


For example I have 187 annotation instances in Calypso. They should not be
instantiated during lookup


>
>
> -----
> Cheers,
> Sean
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
>
>

Reply via email to