From: Stefan Kaes Date: 2005-11-22T15:57:54+09:00 Subject: Re: semenatics of if/unless/while statement modifiers Eric Hodel wrote: > On Nov 21, 2005, at 9:37 PM, Stefan Kaes wrote: > >> I find it rather inelegant to be forced into writing >> >> if x = options[:x] >> f(x) >> end >> >> or even >> >> f(options[:x]) if options[:x] >> >> instead of >> >> f(x) if x=options[:x] > > > f options[:x] if options.include? :x This doesn't solve the problem of accessing the hash twice and computing the hash of the lookup key twice. And it's even more text than before. > >> The Rails source code is literally messed up with the second >> variant, which is potentially slower too. > > > I've found several parts of the Rails source code to be very un- > Rubyish. I would not necessarily equate a line of Rails code to a > problem with Ruby itself. I didn't. It was only an example. -- stefan