The idea is to run S within the user's browser. We can then exploit this S engine in several different ways. URLs containing S scripts can be loaded from a server (identified with a special mime-type) and the code locally within the browser evaluated to create the entire document. Additionlly, we can use the S engine to create interactive and dynamic plots as embedded components/objects within an HTML page. Here, the author provides an area within the document and the S commands to create the plot. A collection of different event handlers can be specified for the plot, giving a richer style of interaction currently possible within R. Finally, and most flexibly, we can use S as an extension of JavaScript, providing access within JavaScript code to the different S functions and also allowing S to access variables created in JavaScript, Java and other plug-ins. In some respects, this style is very similar to the inter-language interfaces for Perl, Python and Java already developed for S. Also, it is a rich example of the component-oriented focus of Omegahat in which the author can chose to program in any of several different langauges and access the objects and functionality in each of the others. Evaluating "fixed" S scripts within each browser is a waste of resources. It can be done just once on the server and the resulting (HTML) document downloaded directly by the client. Where the plug-in adds value is when we have an HTML document that contains dynamic content. Suppose we have an HTML form which allows users to type S expressions and see the output within the browser. We can then add (JavaScript) event handlers to elements in the form (e.g. radio buttons) and have these handlers update the S output. Additionally, we can add Java components that provide us with different graphical interface elements and again, connect these to the S engine to update the displays. Finally, we can develop a browser device-driver so that S graphics are displayed within an HTML page. This can also respond to user actions in new ways. The HTML document can be generated from an XML document that contains S code and from which we generate an HTML document by executing that code and substituting the output in its place. We use the browser to provide the formatting and the dynamic components. We use the S engine to supply (some of) the dynamic content. This provides functionality that is available in via Rweb and Rcgi. However, these require lengthy trips to a server; they do not provide interactive components; and those models do not support dynamic content tied to interactive components.
s.exists("rnorm")
s.attach()
s.library()
s.lm();
We can do this by adding Java entry points for this.
However, we would like to do it dynamically, i.e. on demand lookup and
resolution.
Also, handling packages/namespaces is important.