From: Jean-Hugues ROBERT Date: 2002-06-13T19:25:49+09:00 Subject: Re: ruby-dev summary 17252-17356 Hello, about scope design, Perhaps: xx do local xxx end xx do xxx end after "local" a new scope rule starts applying. For block parameters: xx.each do local |x| xxx end For block variables: x,y,z = 1,2,3 (Proc.new do x = 0 # outer x p x # 0 local # new scope rule starts here x,y = 2,3 # outer x, local y p x,y,z # 2,3,nil versus 2,3,3 without "local" ).call p x,y,z # 2,2,3 versus 2,3,3 without "local" Also (orthogonal): global xx do xxx global; xxx end Ideally: unbound xxx do global; local; xxx end eqv xxx do unbound; xxx end Also: local but with initial values do local a,b,c |x| xxx end where a,b,c are initialized with whatever value they had before. Also: local but initialized at block creation time: do unbound a,b |z| xxx end a,b will be local but initialized with whatever value they had when the block was created. Yours, Jean-Hugues