From: Roger Pack Date: 2008-07-09T13:56:42+09:00 Subject: Re: Faking named parameters and enforcing required params > My question is does anybody know the C code for 'adding' a variable to > the scope above the current? > something like > > > scope->prev->local_vars.push(name, object); > > Thanks! > -R It appears impossible [from casual glancing at the code] to add an arbitrary local variable during runtime. This because it uses a 'parse then run' style execution. I.e. a = 3 b is first translated into ASSIGN(a, 3) CALL(b) and then run consecutively. And a = 2 a is translated into ASSIGN(a, 2) VAR_VALUE(a) since a is already defined. Then run. So it appears that currently the only way to arbitrarily add a local variable would be to hack the parse tree itself. Guess I'll file a requested feature of binding.set_local_variable :) -R -- Posted via http://www.ruby-forum.com/.