From: Mark Hubbart Date: 2005-01-29T05:26:53+09:00 Subject: Re: Type Inference Hi, Maybe some terms and thoughts need to be clarified here. Curt: How are you defining "type"? It gets used so much to mean different things. To you, what defines the type of a particular object? If you go by "types as method signatures", there are obviously cases where they can't be checked at compile time. What should be done in these cases? ie., this code: --- def Foo(other) other.to_foo end Foo(23) --- ... could easily be checked. while this: --- def bar(other) other.send(*gets.chomp.split) end bar(23) --- ... would be impossible to check. We could decide to implement an inconsistant type checking, but full type checking would be impossible. How should difficult/impossible cases be handled? Another difficult case: --- eval(gets) 23.not_a_method --- in this case, it would be not only difficult to detect the error at compile time, but it would be difficult to differentiate between it and an illegal method call. or: --- load "foobar.rb" if ARGV.include? "load" 23.not_a_method --- Loading and requiring is done at runtime, not at compile time. So how would you know which methods were available to an unmodified Integer at runtime? These are just a few examples, mostly attempting to be on the extreme side. But they show a few possible problems with checking types, especially based on method signatures, at compile time. cheers, Mark