From: avi@...4.com (Avi Bryant) Date: 2002-06-13T10:43:31+09:00 Subject: Re: a new block parameter/variable notation (Re: ruby-dev summary 17252-17356) matz@ruby-lang.org (Yukihiro Matsumoto) wrote in message news:<1023845919.929356.32025.nullmailer@picachu.netlab.jp>... > (c-1) local variables assigned by ":=" are in-block variables, > otherwise they are method local variables. If you assigns to > an existing local variable, the variable is shadowed, and you > will probably be warned. Matz, what about making this distinction more general than just block-local vs. method local? That is, always be able to use := to create a new binding rather than modifying an existing one. So, if you had def foo x := 1 y := 2 myproc = lambda{p x, y} x := 10 y = 20 myproc.call end #=> 1 #=> 20 Bindings would be scoped to thier closest enclosing method or block; using = when no binding already existed for the variable would be the same as using :=. My main motivation for wanting this is to ease state management when using continuations for backtracking - creating new bindings is obviously safer here than mutating existing ones. Too lispy? Alternatively, I wouldn't mind seeing an ML-style let x = 1 in ... end But the := thing is probably more Ruby like. Avi