Safe domain specific language implementation

Greeting All,

I am trying to write code that will interpret user submitted scripts in
a secure way. I have a limited set of functions that they should be
able to call to change various states. I also need the usual branching,
loping, and local variable assignment types of things. (see example
code) I hoped to be able to use Ruby’s safe mode for this is ways
similar to http://www.artima.com/rubycs/articles/ruby_as_dslP.html

I have a few questions in this regard:

1). Are there any websites/articles that deal with how to use $SAFE
(particularly level 4)

2). In light of http://code.whytheluckystiff.net/sandbox/wiki is this a
feature that is still in development? (please also see
http://www.ruby-forum.com/topic/79295#131045)

3). What are some implementation options? What would be required in
terms of programming?

Thanks

J.F. Miller

···

=====
Example code

#entrusted user script

#call this function when a power shortage is detected
def power_shortfall
  pl = get_power_reading
  if pl<100
    shutdown_expermint
  else
    reduse_load(1000-pl/10)
  end
end

--
Posted via http://www.ruby-forum.com/.