On Oct 26, 2005, at 8:12 PM, Trans wrote:
> * How to dynamically set annotations? Even with this nice looking
> notation you would still need a  way to do via normal methods.

How about adding methods to Class and Method?

     class Sample
         def foo(a1, a2); end
     end

     Sample.annotate(:author => "Gary Wright")

     method_obj = Sample.new.method("foo")

     method_obj.annotate( :comment => "this is the  
comment", :annotated => Time.now )

> * It's important to allow annotations for methods that do not
> neccessarily exit. In this way annotations would be reusable.  For
> example here is what you can do with facets/annotation.rb

It seems that if you extended Class and Method as I hinted at above that
you could handle run-time annotation with no change to the language  
syntax.
Reuse could be accomplished by passing hash objects around as needed.

On the other hand, if the desire is to make annotations useful as  
source code
documentation (or for use by language tools that are manipulating the  
*source*) then you
probably need some sort of change to the language syntax.

The problem with the facets/annotation.rb approach is that there is  
no way to
statically examine the source and discover the annotations since  
syntactically
the mechanism consists of standard method calls.


Gary Wright