From: Bob Hutchison Date: 2005-10-19T00:29:18+09:00 Subject: Re: Instance and class variable assignment On Oct 18, 2005, at 10:03 AM, Christophe Grandsire wrote: > Selon Daniel Schierbeck : > > >> >> Can someone explain to me why this shouldn't be implemented in Ruby: >> >> def foo(@a, @b = "foo", @@c = "bar") >> # do something >> end >> >> > > My eyes!!! >*_*< > And what are the binding rules? def foo(@a = 1, @@b = @a) is equivalent to what? Common Lisp has two binding rules that generally used, e.g. let and let*. These would give you: def foo(a, b) old_a = @a @a = a @@b = old_a end and def foo(x, a, b) @a = a @@b = @a end You need both in CL. Cheers, Bob ---- Bob Hutchison -- blogs at Recursive Design Inc. -- Raconteur --