From: dblack@... Date: 2003-11-08T22:25:08+09:00 Subject: Re: Managing metadata about attribute types Hi -- On Sat, 8 Nov 2003, John W. Long wrote: > I do wonder: what is really gained by Strong Typing? Are better error > messages the only advantage? An experienced ruby programmer will see a > method-not-defined error message and know that it means the wrong object was > probably passed in to his method. This kind of error message certainly > throws beginning Ruby programmers for a loop, but is it really a weakness of > the language? There's no improvement in error messages that I can see with the StrongTyping module, and of course it still leaves the question of what to do in the event of a method not being defined. Ruby knows what it's doing. It gives you "duck-typed" objects (i.e., objects whose types are inferential and dynamic), and it also gives you a full suite of features and tools for dealing with those objects: * #respond_to? * #method_missing * #method_defined? * NoMethodError (which can be caught) * Test::Unit (and maybe some I'm forgetting :-) not to mention the track record of small, medium, and large Ruby projects (see Rich Kilmer's comments, for example) and the various programming techniques and practices developed and being developed in the course of those projects. It's possible to argue that method and class name checking might provide a kind of bridge between other languages and Ruby, or serve as a kind of "training wheels", but the problem with this is that it takes you away from the practices mentioned above rather than teaching you how to use them. In my view it's better for new Ruby programmers to embrace and adopt these practices from the start. Let me add that neither this point nor this whole discussion is exclusively about Ryan's StrongTyping module. That module provides a convenient wrapper for calling #is_a? a lot, and the robustness and scaleability of calling #is_a? a lot had been called into question by a number of Rubyists long before StrongTyping appeared. Ryan is bearing the brunt of the 'nay' side of it this time around, but that's just because of the timing :-) David -- David Alan Black home: dblack@wobblini.net # New email address work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav