[GOODIE] Method Annotations

Roel Wuyts wuyts at iam.unibe.ch
Thu Aug 21 06:37:33 UTC 2003


I am reading this with much interest, since I have wanted something 
like this for soooo long know, but never gotten around. I simply wanted 
this to be able to add type anntations (results from running my type 
annotator, or manually) to instance variables, arguments, etc. (so in a 
slightly different way than what proposed here). So what are the 
applications that other people see? Depending on that you can see how 
and what you need to implement exactly... I can imagine tons of things 
you can do...

But even while I think some form of annotation mechanism is fun, I 
wonder:
- whether it is necessary? I now added my type annotations in another 
way (a repository and a little change in the browser) and that does 
almost the same thing. But other wishes may be harder to do.

-what are the things you want to annotate? This depends on what you 
want to do with them, of course. I formulated a drastic proposal for a 
student project/diploma: make it possible to annotate any node in the 
parsetree. This would suit me fine :-) Imagine comments you can 
associate with variables, pieces of code, etc.

- why it has to be *IN* the method. Like Craig and Michael mentioned, 
you could also keep them someplace else, associated with the method. 
This is what I did with my type things: I keep them in a dictionary 
somewhere, with the CompiledMethod as key (CompiledMethods are around 
anyway :-) ). You coud even file such things out as doIts without too 
much trouble (to remain lightweight). But again, I think it depends on 
what you want to do.

- Stephane raised an interesting point when we discussed about this a 
couple of weeks ago after a workshop at Ecoop: will you not end up with 
the Pragma mess from C++? If I get a student 'augmenting' the parsetree 
with annotations, you might begin to see different extensions that one 
cannot compile, understand, analyze, ... without knowing the semantics 
of the extension.

- if you look at what happens with pragma's in Visualworks, then you 
see that they are basically just used for adding menu items in method 
extensions. So, when you load a parcel that adds such a method to the 
VisualLauncher, an icon for your tool appears automatically. When you 
unload your parcel, it disappears. This happens in two steps: you have 
to annotate a method, and then another piece of code in VisualLauncher 
runs over the methods to compute a menu. That is the interesting part: 
this calculation is *static* and uses plain meta-programming. As always 
that can be used to mimic a simple dynamic behaviour (keep the stuff in 
some collection where you simply add items). So is this whole mechanism 
worth it? I am not fully convinced...


Anyway, just some points that I want to throw in the group :-) I still 
believe it is worthwhile though.

On Thursday, Aug 21, 2003, at 02:12 Europe/Zurich, Andreas Raab wrote:

>> Aha, cool.  But January 2, 2002, and you never posted this earlier??
>
> To avoid silly discussions about it being a "language modification" 
> that is
> "not needed" and to prevent embarrassing myself by trying to explain 
> that I
> don't give a damn about minimalisitic systems only useful ones ;-)
>
>> I think extending it to support any arity of annotation is
>> probably useful - particularly when you're using annotations
>> to specify UI, it seems like you usually need a number of
>> different pieces of info for each property.
>> And it would be a shame to regress to positional parameters.
>>
>> If that's relatively easy to fix, then this is an ENH I'd lobby to get
>> into the image... I think it opens up a whole bunch of interesting
>> possibilities.
>
> This would be pretty trivial. I simply didn't have a need for it as 
> all of
> my uses require "multi-keyword" annotations exclusively for cases 
> which have
> to be handled specially by the parser anyway, similar to
> <primitive:module:>.
>
> Cheers,
>   - Andreas
>
>
>
Roel Wuyts                                                   Software 
Composition Group
roel.wuyts at iam.unibe.ch                       University of Bern, 
Switzerland
http://www.iam.unibe.ch/~wuyts/
Board Member of the European Smalltalk User Group: www.esug.org



More information about the Squeak-dev mailing list