From: dblack@... Date: 2007-05-11T07:11:30+09:00 Subject: Re: self in blocks Hi -- On Fri, 11 May 2007, Vasco Andrade e silva wrote: > MenTaLguY wrote: >> self will normally refer to self in the lexical scope of the block (#2). >> class_eval, module_eval, instance_eval, and instance_exec are special >> exceptions to this rule. >> >> -mental > > I confess I don't like this approach :S (rules with exceptions, doesn't > fit right..) however thanks for the explanations. > By the way are class_eval, module_eval, instance_eval and instance_exec > the only exceptions? I think so. (I can't remember what instance_exec does/will do, but that's neither here nor there.) It's not really rule plus exception; it's more a kind of hand-crafted quality to the language that provides a nice assortment of the facilities that people actually need, with attention paid to the naming. It's another example of why I have always said that Ruby represents "the triumph of balance over symmetry" :-) David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)