From: Chad Fowler Date: 2004-03-06T06:04:16+09:00 Subject: Re: Duck typing chapter On Fri, 5 Mar 2004, Dave Thomas wrote: # I've posted a rough first pass at a chapter about duck typing (and # other typing issues in Ruby). It covers # # - what a type is # - duck typing # - Ruby's built-in protocols (to_str, to_proc, etc) # - coercion and double dispatch # # http://www.pragmaticprogrammer.com/extracts/ducktyping.pdf # # It isn't typeset, and I haven't really read it through for typos. I'd # be interested to see what folks think. Again, all feedback gratefully # received. # Hi Dave. I read through the chapter, and aside from the obvious typos which you will catch later, I thought it was really well done. You've really captured the essence of how "type" works in Ruby (vs. "Class"). I think this chapter will go a long way toward setting new Rubyists on the right track...hopefully avoiding some of the FAQs and flamewars on ruby-talk. It's just personal opinion, but I felt like you spent a little more energy justifying/selling Ruby's typing philosophy at the beginning. You also pit Ruby's philosophy against that of the Java/C# school. I agree with the comments you've made, but I wonder if it's beneficial to bring out this conflict explicitly. It almost reads like you're having an argument with the reader, based on what you feel their reaction will be. It seemed a little overly confrontational. Others may disagree, though. When you go into to_int and to_str, I felt a little fuzzy when you first mentioned that Roman shouldn't implement to_str. You cleared it up in the following example, but at first I felt like you were moving on, and I didn't feel satisfied that you were going to address this in more detail. It might just be a personal experience that others won't repeat, but if not, I'd say there is a subtle issue with the rhythm in this section. Overall, the explanation was lucid and the examples were really helpful. I loved the "duck typing club" Member joke. :) Chad