From: Loren Segal Date: 2010-09-30T00:03:57+09:00 Subject: [ruby-core:32630] Re: Proposal for Optional Static Typing for Ruby Eleanor, On 9/29/2010 8:33 AM, Eleanor McHugh wrote: > It strikes me that much of the premise behind this thread is misguided as it overlooks the importance of meta-programming in developing any Ruby program of substantive size. Where a Java or C++ programmer might write a factory method to create instances of a class and spend much of their effort enumerating types explicitly, it's not unusual in Ruby to write meta-programs which create a variety of class and method definitions on request to create or repurpose object instances for the task at hand. I'm not sure there's any practical incongruity between meta-programming and type annotations. No amount of meta-programming can change the body of a method. You can replace the method itself (alias_method), but because type annotations would be attached to the methods themselves, the type information would be replaced too. Therefore, you can consider any type annotations to a method declaration to be something of a "contract" for using the method. Of course you can misuse types here (specify something too limiting, or something completely wrong), but it wouldn't be fair to consider the misused cases first. Do you have any examples of where meta-programming would "repurpose" an object such that existing type information would be completely invalid? - Loren