From: senderista@... (Tobin Baker) Date: 2001-06-22T14:40:43+09:00 Subject: [ruby-talk:16746] Re: Simulating call-by-reference in Ruby It occurred to me that return-by-reference (e.g. IDL out parameters) could be simulated using the fact that parameters to a block bind to variables of the same name in the enclosing scope. So we could have: //IDL interface Foo { void bar(out int baz); }; #Ruby baz = nil myFoo.bar {|baz|} p baz #=> 10 where bar might be implemented like: def bar yield 10 end I can't think of a way for a method to retrieve the initial values of parameters to a block, so I guess this would work only for out parameters. Is this reasonable syntax, or is it just getting too ugly?