From: Trans Date: 2005-10-20T11:36:58+09:00 Subject: Re: Method annotation and anonymous functions David A. Black wrote: > Hi -- > > On Thu, 20 Oct 2005, Trans wrote: > > > > > Jeff Wood wrote: > >> Yes it would, but I don't see another way to do attribution of methods > >> without causing compatibility issues .... do you? > > > > Nitro/Facets annotations system works like so: > > > > class X > > def foo ; "foo" ; end > > ann :foo, :returns => String > > end > > > > X.ann :foo, :log => true > > > > X.ann.foo.returns #=> String > > Ugh, if I may permit myself the expression That means goodbye to > things like: > > def meth(thing) > thing[some_thing_else] > end > > Pinning down the class of return values is similar to pinning down the > class of arguments -- arguably even more duck-typing-unfriendly, since > you're specifying not only what a given object has to be but, > potentially, what *its* methods have to return. Perhaps a bad example, b/c as Jeff said, it has no actual effect on anything. Annotations are just notes. Nothing more. They only become more when people use them to do particular stuff. For instance Og uses them to determine how to map objects to a sql/database. In fact I would like to add annotation namespaces. So that Og can separate it's annotations from other's. But I'm not yet sure how that will effect the interface. T.