title: Instantiating Rhinoscript Native Objects from Java/Scala
body: <p>I'm trying to improve the performance of a <strong>javascript snippet evaluator</strong>.  These script snippets can reference any number of variables that exist in a string-keyed map of json-like object graphs (IE: Json AST).  I'm using JDK 1.6 and the embedded Rhinoscript engine (v1.6R2).</p>
  
  <p>Currently, processing takes the form:</p>
  
  <ol>
  <li>Snippet is parsed to discover the names of referenced variables</li>
  <li>Variables are retrieved from the map and serialized to a json string</li>
  <li>Json string is assigned to a similarly named variable at the start of the script</li>
  <li>Evaluate augmented script</li>
  </ol>
  
  <p>I'm trying to figure out how to skip the json serializing stage and create direct Rhinoscript native objects to place in the 'bindings' for the script.  The desired steps would then be:</p>
  
  <ol>
  <li>Snippet is parsed to discover the names of referenced variables</li>
  <li>Variables are retrieved from the map and <strong>converted to native Rhinoscript equivalents</strong></li>
  <li>Native objects are placed in bindings</li>
  <li>Evaluation of original script with said bindings</li>
  </ol>
  
  <p><strong>Do you know</strong> where I could find documentation or examples of how to instantiate native rhinoscript objects?</p>
  
  <p>My scala learning project might be of some use if you want to tinker.  And any answer I come up with should appear there too...</p>
  
  <p><a href="http://subversion.assembla.com/svn/freshcode_public/learn_scala/datastore/src/test/scala/pkg/script" rel="nofollow">http://subversion.assembla.com/svn/freshcode_public/learn_scala/datastore/src/test/scala/pkg/script</a></p>
  
  <p>Thanks in advance.</p>