Robert Klemme <bob.news / gmx.net> wrote:
> 
> "Harry Truax" <htruax / stf.com> schrieb im Newsbeitrag
> news:019801c483b7$4b338d20$1000000a / corp.stf.com...
> > Thanks Austin,
> >
> > But unfortunately $SAFE needs to be set to 3 which will preclude the use
> of
> > eval( ).
> 
> You can set up an evaluator before you switch to $SAFE 3 if you know the
> variables beforehand, IMHO that should work:

Or even set up a way to specify the formulae in as convenient a manner
as possible, then do a one time code-generation pass to generate ruby
code from those formulae. The code itself can be run at whatever safe
level you want, exactly as though you'd typed it in by hand.

This is assuming, of course, that the formulae are all known at compile
time - if they change at runtime, your code generation step will look
more like

1.upto(m) {|i| 1.upto(n) {|j| 
  rubyfile.puts "box[#{i}][%{j}] = box_#{i}_#{j}"
}}

And then write your code after that using the box[i][j] references.

Neither of these use any form of runtime code generation, and should
therefore satisfy the pickiest of safe levels.

martin