From: "Mauricio Fernández" Date: 2002-10-08T19:11:55+09:00 Subject: Re: Specifying local and external block parameters (that old chestnut) On Tue, Oct 08, 2002 at 06:31:03PM +0900, ts wrote: > > * at compile time, the lhs is modified (and a block local variable is > created) *after* ruby has parsed the rhs > > * at runtime, ruby first execute the rhs and then make the assignement > (i.e. create a new block local variable) > > This give something similar to a let* > > pigeon% cat b.rb > #!./ruby > 2.times do |i| > b = i > 3.times do |i| > b := b + i > p "in #{b}" > end > p "out #{b}" > end > > pigeon% > > pigeon% b.rb > ./b.rb:4: warning: shadowing variable `i' > ./b.rb:5: warning: shadowing variable `b' > "in 0" > "in 1" > "in 2" > "out 0" > "in 1" > "in 2" > "in 3" > "out 1" > pigeon% At first sight, this looks great! -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Q: What's the big deal about rm, I have been deleting stuff for years? And never lost anything.. oops! A: ... -- From the Frequently Unasked Questions