Daniel Schierbeck wrote:

> Florian Gro? wrote:
>> I have implemented this in ruby-contract. Please see
>>
>> http://ruby-contract.rubyforge.org/
> 
> Nice, although a bit verbose as a general-usage implementation.

Hm, hard to make it any shorter without changing Ruby itself.

Here's your original:

>   def foo(str bar, i baz, sym bur)
>     # something
>   end 

And here's how to do it with ruby-contract:

>   def foo(bar, baz, bur)
>     # something
>   end 
>   signature(:foo, String, Integer, Symbol)

Perhaps it is time for writing another source code filter. What do you 
think about?

>   def foo(<String> bar, <Integer> baz, <Symbol> bur)

That way you could use any expression where the type appears. Method 
calls, variables and so on.

-- 
http://flgr.0x42.net/