From: Szymon Drejewicz Date: 2004-04-21T20:04:05+09:00 Subject: Re: binding - how to get current script? > name = nil > eval("name = 'Alice'") > puts name > > You can change existing variables, but cannot add new > variables. It's nice to know that eval() works in this way. Maybe in the future I'll use it for change variable value but this time I have to change every 30 local variables to global variables. If I need (and can) to write: name = nil sname = nil age = nil eval("name = 'Alice'") eval("sname = 'Smith'") eval("age = '19'") better is to write just: name = 'Alice' sname = 'Smith' age = '19' but the problem is I don't know the names of that variables for now, so I need to make them parameters: names = someArrayWithVariableNamesProducer values = someArrayWithVariableValuesProducer names.each_with_index { |varName,i| eval("#{varName} = #{values[i]}", MAIN_BINDING) } So I think it is candidate for Ruby-Proposal :-) to make a additional binding named i.e. "MAIN_BINDING" wich points current script... :-) -- Szymon Drejewicz