From: "David A. Black" Date: 2009-07-14T23:43:56+09:00 Subject: Re: Twelve rules of Ruby Hi -- On Tue, 14 Jul 2009, Garry Freemyer wrote: > I would think that the twelve rules should be in the form of what > things are, not what they are not. > > It is also implied that the twelve rules would be something to learn > early on .... so it's for those just starting to learn ruby. > > The rules should then be reasonably clear. > > To say that x is not a character does not tell me as much as telling > me that x is an integer. > > Saying that the identity of self may change and that its best to > learn the rules of when it changes, does not tell me as much as > finding away to tell me the rules. http://www.manning.com/black2 :-) I suppose I'm very teaching-oriented, in the sense that I'm mainly interested in "rules" for understanding and using Ruby successfully. I don't think there's that much point making a list of how self works[1] in the absence of explaining why (at least in part) it's important to understand it. Of course, there are no twelve rules. Better is for everyone to interpret the invitation how they see fit. We don't have to (and won't, and can't) reach some kind of twelve-rule consensus. That's a red herring. David [1] In a method definition, it's the object that received the message. In a or module class definition body, outside of a method definition, it's the class or module object. At the top level, it's a special "backstop" object called "main". In an instance_eval or instance_exec block, it's the receive of the instance_eval message. In a class_/module_eval block, it's the class or module object. That's off the top of my head (too lazy to look at the book sitting next to me :-) but I think that's about it. -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Grounded Rubyist (http://manning.com/black2) Training! Intro to Ruby, with Black & Kastner, September 14-17 (More info: http://rubyurl.com/vmzN)