[Pharo-dev] [Ann] Class meta annotations

Denis Kudriashov dionisiydk at gmail.com
Wed Oct 4 09:13:24 EDT 2017

2017-10-04 14:34 GMT+02:00 Henrik Sperre Johansen <
henrik.s.johansen at 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,

Looking forward to trying it out!
> Cheers,
> Henry
> --
> Sent from: http://forum.world.st/Pharo-Smalltalk-Developers-f1294837.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20171004/6376f918/attachment-0002.html>

More information about the Pharo-dev mailing list