[Ann] Class meta annotations
Hi. I glad to present one class package which introduces reusable mechanism for first class annotations. The project can be found on github https://github.com/dionisiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html. And here is overview: Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation: MyClass class>>specialAnnotation <classMetaAnnotation> ^MySpecialAnnotation new To query annotations from system there are two methods: 1) You can ask concrete annotation class for all declared instances: MySpecialAnnotation declaredInstances 2) You can ask given class for all attached annotations: MyClass metaAnnotations Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block. Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code. Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library. Best regards, Denis
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :) On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/ dionisiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
-- 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 <http://www.cnrs.fr>* *Web:* *http://guillep.github.io* <http://guillep.github.io> *Phone: *+33 06 52 70 66 13
2017-09-25 17:09 GMT+02:00 Guillermo Polito <guillermopolito@gmail.com>:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
First of all we can rename it. We discussed name with Marcus. And our feeling was that simple "class annotation" name is a bit collide with "class properties" which we also have. So we added extra word to the name but maybe it not makes any sense. Also we thought about ClassPragma name. But it is possible that with new class definition we will be able to annotate classes just in place like methods. Also using the name different from pragma is good (or feels good) to get some sign that it uses different mechanizm.
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
I agree with guille. We should just called them class annotations. Denis what is a declared instance (is it an object returned by the method having the annotation) but can we find a better name. may be effectiveInstances? On Mon, Sep 25, 2017 at 5:09 PM, Guillermo Polito <guillermopolito@gmail.com
wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
2017-09-25 17:38 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
I agree with guille. We should just called them class annotations.
Denis what is a declared instance (is it an object returned by the method having the annotation) but can we find a better name.
My idea that the method with pragma #classMetaAnnotation is the declaration of annotation. Internally this declaration creates instance of specified annotation which cached by system. And users access all these declared instances for reflection purposes. Also annotation has inst var declarationSelector.
may be effectiveInstances?
I don't like this name. I not understand "effective" in that context.
On Mon, Sep 25, 2017 at 5:09 PM, Guillermo Polito < guillermopolito@gmail.com> wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
Effective means instances. Because I do not understand what declared are. On Mon, Sep 25, 2017 at 5:57 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2017-09-25 17:38 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
I agree with guille. We should just called them class annotations.
Denis what is a declared instance (is it an object returned by the method having the annotation) but can we find a better name.
My idea that the method with pragma #classMetaAnnotation is the declaration of annotation. Internally this declaration creates instance of specified annotation which cached by system. And users access all these declared instances for reflection purposes.
Also annotation has inst var declarationSelector.
may be effectiveInstances?
I don't like this name. I not understand "effective" in that context.
On Mon, Sep 25, 2017 at 5:09 PM, Guillermo Polito < guillermopolito@gmail.com> wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
2017-09-25 17:57 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com>:
2017-09-25 17:38 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
I agree with guille. We should just called them class annotations.
Denis what is a declared instance (is it an object returned by the method having the annotation) but can we find a better name.
My idea that the method with pragma #classMetaAnnotation is the declaration of annotation. Internally this declaration creates instance of specified annotation which cached by system. And users access all these declared instances for reflection purposes.
Maybe #registeredInstances would be better?
Also annotation has inst var declarationSelector.
may be effectiveInstances?
I don't like this name. I not understand "effective" in that context.
On Mon, Sep 25, 2017 at 5:09 PM, Guillermo Polito < guillermopolito@gmail.com> wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
2017-09-28 18:17 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com>:
2017-09-25 17:57 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com>:
2017-09-25 17:38 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
I agree with guille. We should just called them class annotations.
Denis what is a declared instance (is it an object returned by the method having the annotation) but can we find a better name.
My idea that the method with pragma #classMetaAnnotation is the declaration of annotation. Internally this declaration creates instance of specified annotation which cached by system. And users access all these declared instances for reflection purposes.
Maybe #registeredInstances would be better?
So I rename these messages too. I think it's better.
Also annotation has inst var declarationSelector.
may be effectiveInstances?
I don't like this name. I not understand "effective" in that context.
On Mon, Sep 25, 2017 at 5:09 PM, Guillermo Polito < guillermopolito@gmail.com> wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov <dionisiydk@gmail.com
wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
Thanks On Thu, Sep 28, 2017 at 6:36 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2017-09-28 18:17 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com>:
2017-09-25 17:57 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com>:
2017-09-25 17:38 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
I agree with guille. We should just called them class annotations.
Denis what is a declared instance (is it an object returned by the method having the annotation) but can we find a better name.
My idea that the method with pragma #classMetaAnnotation is the declaration of annotation. Internally this declaration creates instance of specified annotation which cached by system. And users access all these declared instances for reflection purposes.
Maybe #registeredInstances would be better?
So I rename these messages too. I think it's better.
Also annotation has inst var declarationSelector.
may be effectiveInstances?
I don't like this name. I not understand "effective" in that context.
On Mon, Sep 25, 2017 at 5:09 PM, Guillermo Polito < guillermopolito@gmail.com> wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov < dionisiydk@gmail.com> wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
Yes. On Thu, Sep 28, 2017 at 6:17 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2017-09-25 17:57 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com>:
2017-09-25 17:38 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
I agree with guille. We should just called them class annotations.
Denis what is a declared instance (is it an object returned by the method having the annotation) but can we find a better name.
My idea that the method with pragma #classMetaAnnotation is the declaration of annotation. Internally this declaration creates instance of specified annotation which cached by system. And users access all these declared instances for reflection purposes.
Maybe #registeredInstances would be better?
Also annotation has inst var declarationSelector.
may be effectiveInstances?
I don't like this name. I not understand "effective" in that context.
On Mon, Sep 25, 2017 at 5:09 PM, Guillermo Polito < guillermopolito@gmail.com> wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov <dionisiydk@gmail.com
wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
On 25 Sep 2017, at 17:38, Stephane Ducasse <stepharo.self@gmail.com> wrote:
I agree with guille. We should just called them class annotations.
The problem that I see is that people will confuse them with per class properties (and pragmas, should we add them). If I hear âclass annotationâ I think that this is something visible in the class definition pane. But I have no strong opinion, that is, if everyone else thinks the name is good I am ok with it. Marcus
I would prefer to remove the meta. because class instance variables are not class meta instance variables :) On Mon, Sep 25, 2017 at 5:59 PM, Marcus Denker <marcus.denker@inria.fr> wrote:
On 25 Sep 2017, at 17:38, Stephane Ducasse <stepharo.self@gmail.com> wrote:
I agree with guille. We should just called them class annotations.
The problem that I see is that people will confuse them with per class properties (and pragmas, should we add them).
If I hear âclass annotationâ I think that this is something visible in the class definition pane.
But I have no strong opinion, that is, if everyone else thinks the name is good I am ok with it.
Marcus
Shhh... The first rule of meta-club is we don't talk about meta-club. cheers -ben On Mon, Sep 25, 2017 at 11:09 PM, Guillermo Polito < guillermopolito@gmail.com> wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
;) On Tue, Sep 26, 2017 at 1:28 PM, Ben Coman <btc@openinworld.com> wrote:
Shhh... The first rule of meta-club is we don't talk about meta-club.
cheers -ben
On Mon, Sep 25, 2017 at 11:09 PM, Guillermo Polito < guillermopolito@gmail.com> wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
So I renamed it to ClassAnnotation with all related names. But I keep meta prefix in #metaAnnotations Class extension to avoid general name: MyClass metaAnnotations You can check updated readme for details https://github.com/dionisiydk/ClassAnnotation 2017-09-26 17:31 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
;)
On Tue, Sep 26, 2017 at 1:28 PM, Ben Coman <btc@openinworld.com> wrote:
Shhh... The first rule of meta-club is we don't talk about meta-club.
cheers -ben
On Mon, Sep 25, 2017 at 11:09 PM, Guillermo Polito < guillermopolito@gmail.com> wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
I would not use meta because you would not write annotationAnnotations :) and annotations is meta by its name. classAnnotation is much better than metaAnnotation Stef On Thu, Sep 28, 2017 at 5:40 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
So I renamed it to ClassAnnotation with all related names.
But I keep meta prefix in #metaAnnotations Class extension to avoid general name:
MyClass metaAnnotations
You can check updated readme for details https://github.com/ dionisiydk/ClassAnnotation
2017-09-26 17:31 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
;)
On Tue, Sep 26, 2017 at 1:28 PM, Ben Coman <btc@openinworld.com> wrote:
Shhh... The first rule of meta-club is we don't talk about meta-club.
cheers -ben
On Mon, Sep 25, 2017 at 11:09 PM, Guillermo Polito < guillermopolito@gmail.com> wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov <dionisiydk@gmail.com
wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
2017-09-28 21:12 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
I would not use meta because you would not write annotationAnnotations :) and annotations is meta by its name.
classAnnotation is much better than metaAnnotation
Done.
Stef
On Thu, Sep 28, 2017 at 5:40 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
So I renamed it to ClassAnnotation with all related names.
But I keep meta prefix in #metaAnnotations Class extension to avoid general name:
MyClass metaAnnotations
You can check updated readme for details https://github.com/dio nisiydk/ClassAnnotation
2017-09-26 17:31 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
;)
On Tue, Sep 26, 2017 at 1:28 PM, Ben Coman <btc@openinworld.com> wrote:
Shhh... The first rule of meta-club is we don't talk about meta-club.
cheers -ben
On Mon, Sep 25, 2017 at 11:09 PM, Guillermo Polito < guillermopolito@gmail.com> wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov < dionisiydk@gmail.com> wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
tx! On Fri, Sep 29, 2017 at 9:58 AM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2017-09-28 21:12 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
I would not use meta because you would not write annotationAnnotations :) and annotations is meta by its name.
classAnnotation is much better than metaAnnotation
Done.
Stef
On Thu, Sep 28, 2017 at 5:40 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
So I renamed it to ClassAnnotation with all related names.
But I keep meta prefix in #metaAnnotations Class extension to avoid general name:
MyClass metaAnnotations
You can check updated readme for details https://github.com/dio nisiydk/ClassAnnotation
2017-09-26 17:31 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
;)
On Tue, Sep 26, 2017 at 1:28 PM, Ben Coman <btc@openinworld.com> wrote:
Shhh... The first rule of meta-club is we don't talk about meta-club.
cheers -ben
On Mon, Sep 25, 2017 at 11:09 PM, Guillermo Polito < guillermopolito@gmail.com> wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov < dionisiydk@gmail.com> wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
Ok, I'm back from vacations so I'll give a comment other than what I did :P. First I like it. Second, how does it work with respect to inheritance? I mean, if I have for example: ClassAnnotation subclass: MyFrameworkAnnotation. And then MyFrameworkAnnotation subclass: MyConcreteAnnotation1. MyFrameworkAnnotation subclass: MyConcreteAnnotation2. Can I query all my annotations or should do an isKindOf: by hand? On Fri, Sep 29, 2017 at 1:10 PM, Stephane Ducasse <stepharo.self@gmail.com> wrote:
tx!
On Fri, Sep 29, 2017 at 9:58 AM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2017-09-28 21:12 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
I would not use meta because you would not write annotationAnnotations :) and annotations is meta by its name.
classAnnotation is much better than metaAnnotation
Done.
Stef
On Thu, Sep 28, 2017 at 5:40 PM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
So I renamed it to ClassAnnotation with all related names.
But I keep meta prefix in #metaAnnotations Class extension to avoid general name:
MyClass metaAnnotations
You can check updated readme for details https://github.com/dio nisiydk/ClassAnnotation
2017-09-26 17:31 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
;)
On Tue, Sep 26, 2017 at 1:28 PM, Ben Coman <btc@openinworld.com> wrote:
Shhh... The first rule of meta-club is we don't talk about meta-club.
cheers -ben
On Mon, Sep 25, 2017 at 11:09 PM, Guillermo Polito < guillermopolito@gmail.com> wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov < dionisiydk@gmail.com> wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
-- 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 <http://www.cnrs.fr>* *Web:* *http://guillep.github.io* <http://guillep.github.io> *Phone: *+33 06 52 70 66 13
I implement query for annotations of concrete class. So right now if you will do MyFrameworkAnnotation registeredInstances it will return only MyFrameworkAnnotation instances. It will not include any MyConcreteAnnotation instance. We can change this part if it is better to work with all subclasses. Or we can introduce another message like registeredSubInstances with consistency to general allSubInstances method, Another detail about inheritance: subclasses inherit superclass annotations and override them. 2017-10-03 12:10 GMT+02:00 Guillermo Polito <guillermopolito@gmail.com>:
Ok, I'm back from vacations so I'll give a comment other than what I did :P.
First I like it.
Second, how does it work with respect to inheritance? I mean, if I have for example:
ClassAnnotation subclass: MyFrameworkAnnotation.
And then
MyFrameworkAnnotation subclass: MyConcreteAnnotation1. MyFrameworkAnnotation subclass: MyConcreteAnnotation2.
Can I query all my annotations or should do an isKindOf: by hand?
On Fri, Sep 29, 2017 at 1:10 PM, Stephane Ducasse <stepharo.self@gmail.com
wrote:
tx!
On Fri, Sep 29, 2017 at 9:58 AM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2017-09-28 21:12 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
I would not use meta because you would not write annotationAnnotations :) and annotations is meta by its name.
classAnnotation is much better than metaAnnotation
Done.
Stef
On Thu, Sep 28, 2017 at 5:40 PM, Denis Kudriashov <dionisiydk@gmail.com
wrote:
So I renamed it to ClassAnnotation with all related names.
But I keep meta prefix in #metaAnnotations Class extension to avoid general name:
MyClass metaAnnotations
You can check updated readme for details https://github.com/dio nisiydk/ClassAnnotation
2017-09-26 17:31 GMT+02:00 Stephane Ducasse <stepharo.self@gmail.com>:
;)
On Tue, Sep 26, 2017 at 1:28 PM, Ben Coman <btc@openinworld.com> wrote:
Shhh... The first rule of meta-club is we don't talk about meta-club.
cheers -ben
On Mon, Sep 25, 2017 at 11:09 PM, Guillermo Polito < guillermopolito@gmail.com> wrote:
Why calling them meta-annotation and not just annotation? Annotations are in general already meta :)
On Mon, Sep 25, 2017 at 5:01 PM, Denis Kudriashov < dionisiydk@gmail.com> wrote:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/dion isiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
I also realized that this library automatically adds annotations to packages because we are now able annotate manifest classes 2017-09-25 17:01 GMT+02:00 Denis Kudriashov <dionisiydk@gmail.com>:
Hi.
I glad to present one class package which introduces reusable mechanism for first class annotations.
The project can be found on github https://github.com/ dionisiydk/ClassMetaAnnotation. And I tried to describe why it is needed in my blog http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html.
And here is overview:
Every annotation should be subclass of ClassMetaAnnotation. To attach it to class you create new class side method which will return an instance of the annotation. Method should be marked with pragma #classMetaAnnotation:
MyClass class>>specialAnnotation
<classMetaAnnotation>
^MySpecialAnnotation new
To query annotations from system there are two methods:
1) You can ask concrete annotation class for all declared instances:
MySpecialAnnotation declaredInstances
2) You can ask given class for all attached annotations:
MyClass metaAnnotations
Every annotation includes information about annotated class and the selector of declaring method. All annotations are cached. So it is cheap to query them. There are extra messages to enumerate annotations using block.
Now let's discuss it. I think it can be good addition for the Pharo 7. Especially that it is very small code.
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Best regards, Denis
Denis Kudriashov wrote
I also realized that this library automatically adds annotations to packages because we are now able annotate manifest classes
This all sounds very cool, but would you mind explaining the motivation a bit? For example, isn't a manifest class itself meta-information about a package? What does this new feature enable us to do for/with classes and packages that we couldn't do before? Thanks! ----- Cheers, Sean -- Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
2017-10-03 14:38 GMT+02:00 Sean P. DeNigris <sean@clipperadams.com>:
Denis Kudriashov wrote
I also realized that this library automatically adds annotations to packages because we are now able annotate manifest classes
This all sounds very cool, but would you mind explaining the motivation a bit? For example, isn't a manifest class itself meta-information about a package? What does this new feature enable us to do for/with classes and packages that we couldn't do before? Thanks!
I thought I explained it in my blog <http://dionisiydk.blogspot.fr/2017/09/class-meta-annotations.html>. But I know that I am a bad writer. For Commander examples look at github https://github.com/dionisiydk/Commander/tree/dev. It's still draft and not full. About packages It was just an idea. Yes, Manifest is a meta information itself. But you are not able to extend it from different packages like class extensions. I don't know where it can be needed. But with class annotation approach you can do it. Actually it is the main feature required for Commander: UI packages extend commands from domain packages with information how to access and execute them from UI. It makes commands reusable.
----- Cheers, Sean -- Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
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. What I don't understand is the difference between, for example:
CmdCommand class>>#activators ^ self classAnnotations select: [ :each | each isKindOf: CmdCommandActivationStrategy ] and a <commandActivationStrategy> pragma which signifies a message returning an appropriate object. ----- Cheers, Sean -- Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
2017-10-03 16:15 GMT+02:00 Sean P. DeNigris <sean@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
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.html
I'd even call them First class pragmas from that point of view :P I wonder what are the side-effects of instantiating the annotation yourself in a method. specialAnnotationExample <classAnnotation> ^MySpecialAnnotation new 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. Do we want annotations to be stateless? Or depend only in literals? I wonder then what is the main difference with specialAnnotationExample <classAnnotation: MySpecialAnnotation> And what is the impact of having an annotation with parameters. On Tue, Oct 3, 2017 at 9:02 PM, Sean P. DeNigris <sean@clipperadams.com> 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.html
-- 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 <http://www.cnrs.fr>* *Web:* *http://guillep.github.io* <http://guillep.github.io> *Phone: *+33 06 52 70 66 13
2017-10-04 9:48 GMT+02:00 Guillermo Polito <guillermopolito@gmail.com>:
I'd even call them First class pragmas from that point of view :P
Yes. But we decided avoid pragma related names here. Because in future it can be possible to add normal pragmas into the class definition.
I wonder what are the side-effects of instantiating the annotation yourself in a method.
specialAnnotationExample <classAnnotation> ^MySpecialAnnotation new
I not understand the question. You supposed to return an *instance* of the annotation from the "annotating method".
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?
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 with
specialAnnotationExample <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: ClyPackageBrowserContext It 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. 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 <sean@clipperadams.com> 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.html
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
Denis Kudriashov wrote
2017-10-04 9:48 GMT+02:00 Guillermo Polito <
guillermopolito@
>:
I'd even call them First class pragmas from that point of view :P
Yes. But we decided avoid pragma related names here. Because in future it can be possible to add normal pragmas into the class definition.
I wonder what are the side-effects of instantiating the annotation yourself in a method.
specialAnnotationExample
<classAnnotation>
^MySpecialAnnotation new
I not understand the question. You supposed to return an *instance* of the annotation from the "annotating method".
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?
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 with
specialAnnotationExample
<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: ClyPackageBrowserContext
It will be very complicated to express it with method pragma and it will be restricted anyway.
Would it? With pure method tags, you'd do something like: SomeClass >> #renamePackage: aPackage <command: 'Rename package' category: 'Package' order: 25 shortcut: #($r meta)> ... method renaming package here ... Then have different pragma traversers capable of creating the actual menus / commands invoking such methods. (And yes, all caching/invalidation would be the responsibility of the traverser(s) if necessary, as usual) Cheers, Henry -- Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
2017-10-04 11:56 GMT+02:00 Henrik Sperre Johansen < henrik.s.johansen@veloxit.no>:
Denis Kudriashov wrote
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: ClyPackageBrowserContext
It will be very complicated to express it with method pragma and it will be restricted anyway.
Would it? With pure method tags, you'd do something like: SomeClass >> #renamePackage: aPackage <command: 'Rename package' category: 'Package' order: 25 shortcut: #($r meta)> ... method renaming package here ...
Then have different pragma traversers capable of creating the actual menus /
commands invoking such methods.
So instead of simple subclassing of ClassAnnotation you would suggest me to implement pragma traversal/interpreter? I would prefer first. It gives me for free the object with any structure without any tricky literal interpretation logic. For me annotation is just obviously simpler solution. Also try to think how to support blocks in parameters with pragma approach. And how fun would be to debug them. It is for the question about "restricted anyway". Really, with annotations you have normal smalltalk code for annotating classes. No magic. And implementation is really simple. (And yes, all caching/invalidation would be the responsibility of the
traverser(s) if necessary, as usual)
Cheers, Henry
-- Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
Denis Kudriashov wrote
2017-10-04 11:56 GMT+02:00 Henrik Sperre Johansen <
henrik.s.johansen@
:
Denis Kudriashov wrote
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: ClyPackageBrowserContext
It will be very complicated to express it with method pragma and it will be restricted anyway.
Would it? With pure method tags, you'd do something like: SomeClass >> #renamePackage: aPackage
<command: 'Rename package'
category: 'Package'
order: 25 shortcut: #($r meta)> ... method renaming package here ...
Then have different pragma traversers capable of creating the actual menus /
commands invoking such methods.
So instead of simple subclassing of ClassAnnotation you would suggest me to implement pragma traversal/interpreter? I would prefer first. It gives me for free the object with any structure without any tricky literal interpretation logic. For me annotation is just obviously simpler solution.
A traverser doesn't have to be a lot of work; http://forum.world.st/Having-comments-for-pragma-tp4902987p4903058.html Denis Kudriashov wrote
Also try to think how to support blocks in parameters with pragma approach. And how fun would be to debug them. It is for the question about "restricted anyway".
You wouldn't need them. What to do with the tag, is up to the traverser. For instance, #perform'ing one of the literal args on the domain class traverser creates, returning an appropriate block, if strictly necessary. Denis Kudriashov wrote
Really, with annotations you have normal smalltalk code for annotating classes. No magic. And implementation is really simple.
Same with a traverser; the normal smalltalk code to create your domain objects is simply in a different place; the traverser part of the package defining said domain, rather than as an extension method marked with a tag. I guess it's best to just agree to disagree, and since you're the one implementing... ;) Looking forward to trying it out! Cheers, Henry -- Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
2017-10-04 14:34 GMT+02:00 Henrik Sperre Johansen < henrik.s.johansen@veloxit.no>:
Denis Kudriashov wrote
Would it? With pure method tags, you'd do something like: SomeClass >> #renamePackage: aPackage
<command: 'Rename package'
category: 'Package'
order: 25 shortcut: #($r meta)> ... method renaming package here ...
Then have different pragma traversers capable of creating the actual menus /
commands invoking such methods.
So instead of simple subclassing of ClassAnnotation you would suggest me to implement pragma traversal/interpreter? I would prefer first. It gives me for free the object with any structure without any tricky literal interpretation logic. For me annotation is just obviously simpler solution.
A traverser doesn't have to be a lot of work; http://forum.world.st/Having-comments-for-pragma-tp4902987p4903058.html
Denis Kudriashov wrote
Also try to think how to support blocks in parameters with pragma approach. And how fun would be to debug them. It is for the question about "restricted anyway".
You wouldn't need them. What to do with the tag, is up to the traverser. For instance, #perform'ing one of the literal args on the domain class traverser creates, returning an appropriate block, if strictly necessary.
Which means restriction to me because I could not simply use a block in the place of pragma.
Denis Kudriashov wrote
Really, with annotations you have normal smalltalk code for annotating classes. No magic. And implementation is really simple.
Same with a traverser; the normal smalltalk code to create your domain objects is simply in a different place; the traverser part of the package defining said domain, rather than as an extension method marked with a tag.
But example with #($r meta) shows that it is not normal smalltalk code. I could not put halt here (I expect that halt will work, but it will debug interpreter code instead of expression). Also extension methods here is a very important feature and not just a mechanism. Because it provides the way how to annotate existing classes from external packages. It is pretty cool feature which not exists in java or C#.
I guess it's best to just agree to disagree, and since you're the one implementing... ;)
Ok, Henrik. But last note: Pragma is low level annotation mechanism and actually more than annotation which was discussed many times in past. But with this library I tried to generalise the way how we use pragmas to annotate classes. Of course you can use pragmas to implement my examples. But I argue that it will require more complex code. Best regards, Denis Looking forward to trying it out!
Cheers, Henry
-- Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
On Wed, Oct 4, 2017 at 10:51 AM, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2017-10-04 9:48 GMT+02:00 Guillermo Polito <guillermopolito@gmail.com>:
I'd even call them First class pragmas from that point of view :P
Yes. But we decided avoid pragma related names here. Because in future it can be possible to add normal pragmas into the class definition.
I wonder what are the side-effects of instantiating the annotation yourself in a method.
specialAnnotationExample <classAnnotation> ^MySpecialAnnotation new
I not understand the question. You supposed to return an *instance* of the annotation from the "annotating method".
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: someInstVarOfMyClass If your someInstVarOfMyClass changes its value after the creation of the Annotation object, you're dead.
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 with
specialAnnotationExample <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: ClyPackageBrowserContext
It 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 <sean@clipperadams.com> 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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
-- 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 <http://www.cnrs.fr>* *Web:* *http://guillep.github.io* <http://guillep.github.io> *Phone: *+33 06 52 70 66 13
2017-10-04 14:43 GMT+02:00 Guillermo Polito <guillermopolito@gmail.com>:
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: someInstVarOfMyClass
If your someInstVarOfMyClass changes its value after the creation of the Annotation object, you're dead.
Yes, you are right. And I have similar cases in Calypso. For some command sub-hierarchy I define shortcut like: ^CmdShortcutCommandActivation by: self defaultShorcurtCombination for: ClassBrowserContext. And command annotations are not updated when I change the method #defaultShorcurtCombination. So I manually reset cache after such changes. Would be interesting to find solution for this.
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 with
specialAnnotationExample <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: ClyPackageBrowserContext
It 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 <sean@clipperadams.com> 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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
--
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 <http://www.cnrs.fr>*
*Web:* *http://guillep.github.io* <http://guillep.github.io>
*Phone: *+33 06 52 70 66 13 <+33%206%2052%2070%2066%2013>
Denis Kudriashov wrote
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Embarrassingly, I'm not quite clear on what this all means so I'll be eager to hear the results of the case study with Commander and Calypso! ----- Cheers, Sean -- Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
+1 just call them class annotations. "annotation" itself already means "meta-information" What are class properties ? How do annotations relate to Magritte? I'm guessing Magritte descriptions are a specific kind of annotation already, right? About #declaredInstances: you could do MySpecialAnnotation new in a playground⦠but that instance would not be attached to any class. I think the point of that query is to return the annotation instances that do come from an actual class with an actual method with the <classAnnotation> pragma. BTW, what if the method with <classAnnotation> returns a different result each time? On 26 September 2017 at 03:11, Sean P. DeNigris <sean@clipperadams.com> wrote:
Denis Kudriashov wrote
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Embarrassingly, I'm not quite clear on what this all means so I'll be eager to hear the results of the case study with Commander and Calypso!
----- Cheers, Sean -- Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
-- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
2017-09-26 10:45 GMT+02:00 Damien Pollet <damien.pollet@gmail.com>:
+1 just call them class annotations. "annotation" itself already means "meta-information"
What are class properties ?
Any class has dictionary of arbitrary properties: MyClass propertyAt: #testKey put: #testValue
How do annotations relate to Magritte? I'm guessing Magritte descriptions are a specific kind of annotation already, right?
For the class side descriptions yes. But for instance side not because they looks like object specific annotations.
About #declaredInstances: you could do MySpecialAnnotation new in a playground⦠but that instance would not be attached to any class. I think the point of that query is to return the annotation instances that do come from an actual class with an actual method with the <classAnnotation> pragma.
yes.
BTW, what if the method with <classAnnotation> returns a different result each time?
All annotations in system are collected and cached when you first time query for any of them. So you will work with same annotation instances until the cache will be reset. But annotation redefines equality in the way that two annotations from same method will be equal after cache rebuilt.
On 26 September 2017 at 03:11, Sean P. DeNigris <sean@clipperadams.com> wrote:
Denis Kudriashov wrote
Also I would like to thank Marcus who helps me realize this concept in Commander and Calypso which I start simplify with this library.
Embarrassingly, I'm not quite clear on what this all means so I'll be eager to hear the results of the case study with Commander and Calypso!
----- Cheers, Sean -- Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
-- Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet
On 26 Sep 2017, at 10:45, Damien Pollet <damien.pollet@gmail.com> wrote:
+1 just call them class annotations. "annotation" itself already means "meta-information"
What are class properties ?
You can say: Object propertyAt: #hello put: true. e.g instead of checking if the name starts with a certain substring, we now implement #isObsolete like this: isObsolete "Return true if the receiver is obsolete." ^ self propertyAt: #obsolete ifAbsent: false
participants (8)
-
Ben Coman -
Damien Pollet -
Denis Kudriashov -
Guillermo Polito -
Henrik Sperre Johansen -
Marcus Denker -
Sean P. DeNigris -
Stephane Ducasse