> Was is really necessary to introduce pragmas here?
> 
> In short: Commander needs pragma to query methods for command lookup. What 
> alternative you could suggest? 

I would imagine that your activatorClass can lookup the command simply as:

PackageCommand allSubclasses select: [ :c | c isEnabledFor: … ]

Would this not work? 
I am personally not keen of using pragma. The worth is when you have no idea 
what a pragma does and looking for implementors or sender does not help. Here 
is an example:
-=-=-=-=-=-=-=-=-=-=-=-=
 RadioButtonModel>>canDeselectByClick
        <api: #inspect>
        "Return true clicking on a selected radio button deselects it"

        ^ canDeselectByClick value
-=-=-=-=-=-=-=-=-=-=-=-=

No idea what is the effect of the #api: pragma. There is no implementor of it. 
I could also the example of the Fame metamodel. 
Anyway, the fact that I am kind of complaining should not prevent you from 
moving ahead. I would be happy having Calypso in the image, even if pragmas. 

Go go go!

Cheers,
Alexandre


> 
> In details:
>  
> Commander caches all activators for each command class. It searches all 
> methods which supply them using pragma and store all retrieved instances in 
> class variable.
> 
> To lookup required commands users enumerate cached activators declared for 
> given context:
> activatorClass allDeclaredFor: aToolContext do: blockWithActivator
> This process is fast and not produces any garbage.
> 
> Also activation methods are supposed to be packaged together with application 
> which provide context for them. They can be in different package than 
> commands.
> Commands are reusable and can be extended by multiple applications with 
> different set of activation methods.
> For example in Calypso I will extract separate SystemCommands package which 
> can be reused by other tools like inspector and debugger. And Calypso will 
> "attach" these commands by own set of extension methods.

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




Reply via email to