The script engine merely executes some chunk of script code with a given context. It has access to the execution context and should be able to call other scripts. Thus you could have scripts which call other scripts which in turn contain any function one wants. So support for script libraries should be supported.
Yours, Paddy Sent via BlackBerry by AT&T -----Original Message----- From: Felix Meschberger <[EMAIL PROTECTED]> Date: Mon, 10 Mar 2008 14:08:30 To:[email protected] Subject: Re: Support for invoking methods in scripts Hi all, Am Montag, den 10.03.2008, 09:39 +0100 schrieb Carsten Ziegeler: > Bertrand Delacretaz wrote: > > Hi Carsten, > > > > On Wed, Mar 5, 2008 at 3:23 PM, Carsten Ziegeler <[EMAIL PROTECTED]> wrote: > >> ...If you think of scripting parts of your application it might be > >> useful to group several methods into one script (for instance a > >> javascript script) and execute exactly one method out of this script.... > > > > Sounds interesting, but can you give an example of how that would be used? > > > Sure :) > > For instance if you want to script server side form validation or script > some rule processing for business logic or script a workflow step etc. > > I think to support this we just need some minor changes: > a) the eval method of the SlingScript needs a return value (Object) The ScriptEngine.eval method already is defined to return an Object. We just would have to forward this value. > b) We need a convention to pass the method name and the method > parameters to the script engine > c) Check for the new info mentioned in b) and if available don't execute > the whole script, but just the single method. The problem with calling a method (or function) is that there will probably not be a script file to be "compiled" and a method called on it but rather some already existing functions or objects in the ScriptEngine scope on which we call a function or method.... Probably we need to enter the arena of direct ScriptEngine use here ?? I am not in favor of defining special hacks into e.g. the SlingBindings object to support this. Regards Felix
