Skip to main content

Beyond JSR-223: Embedded Scripts as First-Class Code

Posted by sanjay_dasgupta on February 6, 2012 at 3:42 AM PST


The term "first-class function" is now very well-known, partly because of the renewed interest in functional-programming languages (Scala, Clojure, Erlang, etc.). But a quick google search shows that the only well-known meaning of "first-class code" is a category of airline travel that includes "Supersonic or First Class Suite (currently only on the Airbus A380)"! Well, for the purposes of this article, script embedded in a Java program is not "first-class code" because it can not use in-scope Java variables unless the variables have been put into the script engine by explicit program action. This article describes the use and development of "InScript" -- a tool that enables scripts in any JSR-223 supported language to use in-scope variables from the embedding Java program naturally -- without the need for any manually programmed action on the Java variables.

Resources-InScript.zip298.87 KB
InScript-Article-17.zip448.68 KB
InScript-Article-20.zip446.75 KB