[Ann] Class meta annotations

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
38 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[Ann] Class meta annotations

Denis Kudriashov
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
Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Guillermo Polito
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 <[hidden email]> 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


Web: http://guillep.github.io

Phone: +33 06 52 70 66 13

Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Denis Kudriashov

2017-09-25 17:09 GMT+02:00 Guillermo Polito <[hidden email]>:
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 <[hidden email]> 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


Web: http://guillep.github.io

Phone: <a href="tel:+33%206%2052%2070%2066%2013" value="+33652706613" target="_blank">+33 06 52 70 66 13


Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Stephane Ducasse-3
In reply to this post by Guillermo Polito
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 <[hidden email]> 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 <[hidden email]> 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


Web: http://guillep.github.io

Phone: <a href="tel:+33%206%2052%2070%2066%2013" value="+33652706613" target="_blank">+33 06 52 70 66 13


Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Denis Kudriashov
2017-09-25 17:38 GMT+02:00 Stephane Ducasse <[hidden email]>:
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 <[hidden email]> 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 <[hidden email]> 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


Web: http://guillep.github.io

Phone: <a href="tel:+33%206%2052%2070%2066%2013" value="+33652706613" target="_blank">+33 06 52 70 66 13



Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Marcus Denker-4
In reply to this post by Stephane Ducasse-3

> On 25 Sep 2017, at 17:38, Stephane Ducasse <[hidden email]> 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


Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Denis Kudriashov
In reply to this post by Denis Kudriashov
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 <[hidden email]>:
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

Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Sean P. DeNigris
Administrator
In reply to this post by Denis Kudriashov
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

Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Damien Pollet
+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 <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Denis Kudriashov


2017-09-26 10:45 GMT+02:00 Damien Pollet <[hidden email]>:
+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 <[hidden email]> 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

Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Marcus Denker-4
In reply to this post by Damien Pollet

> On 26 Sep 2017, at 10:45, Damien Pollet <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Ben Coman
In reply to this post by Guillermo Polito
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 <[hidden email]> 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 <[hidden email]> 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


Web: http://guillep.github.io

Phone: <a href="tel:+33%206%2052%2070%2066%2013" value="+33652706613" target="_blank">+33 06 52 70 66 13


Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Stephane Ducasse-3
In reply to this post by Denis Kudriashov
Effective means instances. 
Because I do not understand what declared are. 


On Mon, Sep 25, 2017 at 5:57 PM, Denis Kudriashov <[hidden email]> wrote:
2017-09-25 17:38 GMT+02:00 Stephane Ducasse <[hidden email]>:
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 <[hidden email]> 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 <[hidden email]> 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


Web: http://guillep.github.io

Phone: <a href="tel:+33%206%2052%2070%2066%2013" value="+33652706613" target="_blank">+33 06 52 70 66 13




Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Stephane Ducasse-3
In reply to this post by Marcus Denker-4
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 <[hidden email]> wrote:

>
>> On 25 Sep 2017, at 17:38, Stephane Ducasse <[hidden email]> 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
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Stephane Ducasse-3
In reply to this post by Ben Coman
;)

On Tue, Sep 26, 2017 at 1:28 PM, Ben Coman <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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


Web: http://guillep.github.io

Phone: <a href="tel:+33%206%2052%2070%2066%2013" value="+33652706613" target="_blank">+33 06 52 70 66 13



Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Denis Kudriashov
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 <[hidden email]>:
;)

On Tue, Sep 26, 2017 at 1:28 PM, Ben Coman <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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


Web: http://guillep.github.io

Phone: <a href="tel:+33%206%2052%2070%2066%2013" value="+33652706613" target="_blank">+33 06 52 70 66 13




Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Denis Kudriashov
In reply to this post by Denis Kudriashov
2017-09-25 17:57 GMT+02:00 Denis Kudriashov <[hidden email]>:
2017-09-25 17:38 GMT+02:00 Stephane Ducasse <[hidden email]>:
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 <[hidden email]> 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 <[hidden email]> 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


Web: http://guillep.github.io

Phone: <a href="tel:+33%206%2052%2070%2066%2013" value="+33652706613" target="_blank">+33 06 52 70 66 13




Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Denis Kudriashov
2017-09-28 18:17 GMT+02:00 Denis Kudriashov <[hidden email]>:
2017-09-25 17:57 GMT+02:00 Denis Kudriashov <[hidden email]>:
2017-09-25 17:38 GMT+02:00 Stephane Ducasse <[hidden email]>:
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 <[hidden email]> 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 <[hidden email]> 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


Web: http://guillep.github.io

Phone: <a href="tel:+33%206%2052%2070%2066%2013" value="+33652706613" target="_blank">+33 06 52 70 66 13





Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Stephane Ducasse-3
In reply to this post by Denis Kudriashov
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 <[hidden email]> 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 <[hidden email]>:
;)

On Tue, Sep 26, 2017 at 1:28 PM, Ben Coman <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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


Web: http://guillep.github.io

Phone: <a href="tel:+33%206%2052%2070%2066%2013" value="+33652706613" target="_blank">+33 06 52 70 66 13





Reply | Threaded
Open this post in threaded view
|

Re: [Ann] Class meta annotations

Stephane Ducasse-3
In reply to this post by Denis Kudriashov
Yes.

On Thu, Sep 28, 2017 at 6:17 PM, Denis Kudriashov <[hidden email]> wrote:
2017-09-25 17:57 GMT+02:00 Denis Kudriashov <[hidden email]>:
2017-09-25 17:38 GMT+02:00 Stephane Ducasse <[hidden email]>:
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 <[hidden email]> 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 <[hidden email]> 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


Web: http://guillep.github.io

Phone: <a href="tel:+33%206%2052%2070%2066%2013" value="+33652706613" target="_blank">+33 06 52 70 66 13





12