From: Alexander Kellett Date: 2005-01-09T07:25:51+09:00 Subject: Re: Type inference in ruby On Jan 8, 2005, at 9:28 PM, Trevor Andrade wrote: > You cannot define how to add integers in Ruby and in fact you cannot > even define > integers themselves. Integers are low level constructs that must be > built > into the language. [snip] its possible to redefine integer additions in ruby. however yes you're correct in saying that its not possible to redefine the integer constructor. (tho i'm working on making that possible ;)) > There is only one thing wrong with type inference and that is that new > methods can be defined at runtime in Ruby which means it is possible > that an > object does not know how to respond at compile time to a message but > it does > know how to respond at runtime. However I think this scenario happens > very > rarely and if it was happening the programmer could just turn off type > inference. i think personally that test suites should guide typing metadata. if a testcase only has a test for a single data type. then the assumption can be made that the type itself is required. if however it has a test for two different data types each of which have a given method, which happens to be part of an included module, to ease test case writing it should be possible via comment hints to show the inferrer / document-type-metadata-hinter that it is duck typed not static typed. Alex