From: Austin Ziegler Date: 2006-09-08T11:17:55+09:00 Subject: Re: optional static typing possible for Ruby ? On 9/7/06, Mr Magpie wrote: > From http://weblog.infoworld.com/udell/2006/09/06.html: > > "We saw a hint of this in episode 2 of The Screening Room, on Adobe > Flex, when Christophe Coenraets talked about the value of ActionScript > 3's optional static typing. "When you already know what your types > should be, declare them," he said. "When you don't, don't." One > language, two styles, complementary benefits." > > This makes a lot of sense to me. eg a function that processes strings > need not accept anything else, would trap certain errors by declaring > acceptable type(s) and would be easier for code completion in an IDE. There's megabytes of discussion on this matter that extend far beyond the earliest ruby-forum.com presence here. Please search the archives before bringing this sort of thing up. Is a StringIO a String object or an IO object? (Hint: it inherits from neither.) Yet if someone were to put class-based typing (which is exactly what this is) on a method, they would prevent the use of StringIO if they wanted IO objects. Further, it is rare that a method needs *exactly* one type of object unless it's a custom object -- and even then, it's possible to simulate that a lot of the time. Type in Ruby is not controlled by classes. Thank Ghu. -austin -- Austin Ziegler * halostatue@gmail.com * http://www.halostatue.ca/ * austin@halostatue.ca * http://www.halostatue.ca/feed/ * austin@zieglers.ca