On Jun 11, 2005, at 11:03 AM, Douglas Livingstone wrote: > On 6/11/05, Gavin Kistner <gavin / refinery.com> wrote: >> If I write code like this: >> self.foo.bar if self.foo >> then ruby runs the #foo method twice. (Javascript is the same way.) > > I'd probably go for: > > result = foo > result.bar unless result.nil? > > If it has to go one one line, could be: > > t = foo and puts t.bar So you've added 1-2 more options to my list, but the intent of my post was not how to rewrite it differently, but to request that perhaps the parser could be a little more extra-intelligent about determining the scope/guaranteed presence of the local variable.