I mean, I understand we can use the class state to initialize the annotation. But the fact that the annotation is cached after its first instantiation means that the annotation will not necessarily evolve as the class evolves.Cache is updated after related class changes: method added, removed and so on (driven by PragmaCollector logic). So outdated annotations should not exist.Is it what you ask?Nope, imagine you do
RenamePackageCommand class>>packageBrowserShortcutActivation <classAnnotation>^CmdShortcutCommandActivation by: $r meta for: someInstVarOfMyClassIf your someInstVarOfMyClass changes its value after the creation of the Annotation object, you're dead.
^CmdShortcutCommandActivation by: self defaultShorcurtCombination for: ClassBrowserContext.
Do we want annotations to be stateless? Or depend only in literals?I want annotations to be any object with any state inside. Of course you will be restricted by what is visible from the class side. But in "annotating method" you can create any complex object (see below).I wonder then what is the main difference withspecialAnnotationExample<classAnnotation: MySpecialAnnotation>And what is the impact of having an annotation with parameters.Generally it is same like having pragma with parameters.But with annotation you are not restricted by literal objects. So annotation parameters can be anything.And it is important feature for Commander.For example I need instance of KMKeyCombination to define shortcut for command. So I just use normal expression for this:RenamePackageCommand class>>packageBrowserShortcutActivation <classAnnotation>^CmdShortcutCommandActivation by: $r meta for: ClyPackageBrowserContextIt will be very complicated to express it with method pragma and it will be restricted anyway.Another important point is that class annotation is first class object which means that you can add behaviour to it.Yes, I get that and I like the idea that the Annotation is not just a command pattern with an execute method. It can be more than that and that's the interesting part of it. Otherwise a normal pragma can just replace it.With method pragma you can not.For example shortcut annotation includes method to check given key event and execute command if it is satisfied.Is it now clear?--On Tue, Oct 3, 2017 at 9:02 PM, Sean P. DeNigris <[hidden email]> wrote:Denis Kudriashov wrote
> If you will use method pragma then you will repeat logic of this library:
> In your code you will need...
So it sounds like it's pragmas++ - the functionality of pragmas plus some
other stuff you may need that you'd have to roll on your own
-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.ht ml
Guille Polito
Research Engineer
Centre de Recherche en Informatique, Signal et Automatique de Lille
CRIStAL - UMR 9189
French National Center for Scientific Research - http://www.cnrs.fr
Phone: <a href="tel:+33%206%2052%2070%2066%2013" value="+33652706613" target="_blank">+33 06 52 70 66 13
--
Guille Polito
Research Engineer
Centre de Recherche en Informatique, Signal et Automatique de Lille
CRIStAL - UMR 9189
French National Center for Scientific Research - http://www.cnrs.fr
Phone: <a href="tel:+33%206%2052%2070%2066%2013" value="+33652706613" target="_blank">+33 06 52 70 66 13
Free forum by Nabble | Edit this page |