From: gabriele renzi Date: 2004-05-20T14:13:49+09:00 Subject: Re: How to duck type? - the psychology of static typing in Ruby il Thu, 20 May 2004 07:33:31 +0900, Hal Fulton ha scritto:: > >Well, here's one comment. > > if foo() > def 5.collect > puts "I exist!" > end > end > >Of course, Fixnums can't have singleton methods now. Later, I think they >may. > >The point is, methods may be added/deleted/redefined at runtime. This >makes static checking very difficult in the general case. > I'd say, from an 'optimistic' perspective that this falls in what sean sees as 'catch something is better than nothing'. Note that this *is* a bug: def foo(x) if x def 5.collect .. end end bar(5) end def bar(x) x.collect end what happens if we do foo(false)? NoSuchMethodError in bar. FWIW, I would be happy to see something like rubylint/checker module, not necessarily in the interpreter itself. I'd like: ruby -rubylint program.rb At least it should be possible to reach the same results similar tools can reach.