From: Jeff Wood Date: 2005-10-20T11:07:18+09:00 Subject: Re: Method annotation and anonymous functions ... the attributes have NOTHING to do with duck typing... that was simply an example chosen by somebody else. I would be using the attributes for testing ... def mytest_of_doom() ann :doc "This function does some blah with blah." ann :test ann :group :working, :ui # do stuff end then you can do things like, I want a list of all functions that are tests. or all functions that are part of group ... or, even better, run-time functionality for getting information on a function while in irb ... ( think about the help() function in python ). Those would all be killer uses of attributed functions. the type thing was simply an example. and notice it had nothing to do with input params ( still whatever you want ). but, it does let you know what the function will spit ( and that helps ides and editors since now they can provide you with a list of methods after the chain... ) It's really a VERY cool idea. I really hope it makes it in. I know most people seem to hate adding a little punctuation ... but sometimes it can be a good thing. j. On 10/19/05, 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. > > > David > > -- > David A. Black > dblack@wobblini.net > > -- "http://ruby-lang.org -- do you ruby?" Jeff Wood