« November 2009
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
     
       
Today
XML

Blog::Navigation

GetJava Download Button
Get the Source
Personal Blog

Blog::Referers

Today's Page Hits: 404

Powered by Roller Weblogger.
« NetBeans scripting... | Main | AppleScript JSR-223... »
20060722 Saturday July 22, 2006

More updates to scripting.dev.java.net

Recent updates to scripting.dev.java.net:

  1. Updated Scheme JSR-223 script engine to use the latest version (1.15.1) of SISC (Second Interpreter of Scheme Code) intepreter. SISC supports is a complete implementation of the language. The entire R5RS Scheme standard is supported, no exceptions - including continuations!
  2. Updated OGNL (Object Graph Navigation Language) JSR-223 script engine to use the latest version (2.6.7) of the implementation. This is (lightweight) expression language for getting and setting properties of Java objects. I like the BigInteger and BigDecimal literals and direct operator support on those types.
  3. Fixed Groovy JSR-223 script engine to give an illusion of single engine level scope for functions. Previously, it was not possible to define a Groovy "global" function in one ScriptEngine.eval() call and call the same in subsequent ScriptEngine.eval() calls. This is because internally, each eval'ed code is compiled as a separate ScriptXXX class. i.e., all global functions in the eval'ed code go into a class derived from Script class. To give an illusion of single engine level scope for "global" functions, we create a map of method closures from all ScriptXXX instances created and search there for global functions (using Groovy's MetaClass mechanism). With this change, the engine behaves as if there is a single global functions scope per ScriptEngine instance. Groovy's Meta Object Protocol (MOP) is really powerful indeed.



( Jul 22 2006, 10:09:47 AM IST ) Permalink Comments [2] del.icio.us | furl | simpy | slashdot | technorati | digg

Comments:

Can you have global functions/attributes with JavaScript/Rhino?

Posted by Alexis MP on July 22, 2006 at 12:58 PM IST #

Hi Alexis MP: Yes, we can have global functions and variables with JavaScript/Rhino. It is supported by language. All top-level variables and functions are actually fields and methods of global "this" object. We can access a global variable by name "x", either as "x" or "this.x" within the toplevel scope. Also, JavaScript treats functions as function-valued properties. (i.e., first-class values). So
   function hello() { print("hello"); }
and
   var hello = function() { print("hello"); }
are same. Did I answer your question?

Posted by A. Sundararajan on July 23, 2006 at 09:40 AM IST #

Post a Comment:

Comments are closed for this entry.
Copyright (C) 2005, A. Sundararajan's Weblog