Hi --

On Mon, 5 Dec 2005, robertj wrote:

> is there any lib where i could emulate attributes on methods
> like there are some libs already now for python 2.4
>
> @params(String, String)
> @return(String)
> def concat(_key1, _key2):
>     return _key1 + _key2
>
> that is something that allows for defining the parameters
> and the return type and the corresponding checks at runtime.

It sounds like you're more interested in class/module ancestry than type.
You can always use is_a? (possibly lightly wrapped, if that makes it feel
more "official" :-)  There are also things like the "StrongTyping" module,
which (despite its name) is, as I understand it, essentially doing the
kind of ancestry-filtering you're interested in.

There's also been some work on type-matching in Ruby, though it's a
non-trivial problem.


David
__
David A. Black
dblack / wobblini.net

"Ruby for Rails", forthcoming from Manning Publications, April 2006!>