Re: [Beanshell-users] The sad state of Javascripting

Nigel Galloway <nigel_galloway-/[email protected]> Wed, 2 May 2007 13:00:40 +0100 (BST)
Newsgroups gmane.comp.java.beanshell.devel,gmane.comp.java.beanshell.user
Message-ID <[email protected]>
I had not realized that beanshell 2.05b was so hard to
find, maybe it has been withdrawn. I've uploaded my
copy to 

http://www.geocities.com/nigel_galloway/BeanShell-2.0b5-src.zip

 for anyone who wants to take it. I tested the claim
that bug
 
1161464  public String t2(){ //This should not be a
constructor

is fixed 2.0b5 and it is. 

Now that I've recovered from having such a rare item,
with perhaps the last fixed beanshell bug, there
remain some fundamental problems (see bug reports:

1272396 Problem throwing an exception 
1272387 Interfaces need not have java.lang.Object as
superclass 
1255984 Problem to continue to a label 
1255937 An exception in break label 
1246854 using an InputStream 
1246841 using a GUI Swing type style of Java 
1237615 BeanShell's handling of
java.lang.NullPointerException 
1225665 byte b3 = 1; byte b4 = -b3; //should not
compile 
1225617 BeanShell's automatic casts are more
restrictive than Java 
1225612 bsh.TokenMgrError: Lexical error at line 1,
column 127. Enc 
1225607 Exception in thread "main"
bsh.Parser$LookaheadSuccess 
1221313 Runtime error using forward referrence 
1221300 Runtime error (Target Exception) using super 
1106071 Comparing Strings dependant on how they are
instanciated 
all made against 2.05b).

I have simpified (trivialized) the examples to
demonstrate the fundamental nature of the problems,
and because I think they are funny. They do however
translate into major deficiencies such as restricting
the abaility to work with native code and use Swing
(see below).

Interpretting Java is a bold objective which goes way
beyond just using the syntax. It has the advantage of
being well known and saves producing a seperate spec.
But as the examples show in many cases Beanshell
produces very different results.

I too look forward to version 3. It will either have
to change its objectives and specify a 'java but
different' language or change its design
fundamentally. I don't think version 2 design, relying
heavily on Classloader can achieve its stated
objectives. Perhaps 3 will make more use of asm (or
OOlang).

I am not sure which bugs you intend to fix in 2.x as I
see none recorded under your names, perhaps you use
nobody? Perhaps the next step is to identify which
bugs can be fixed in this branch, and produce a list
of bugs which will not be considered until 3? This may
reduce the number of bug reports which are in fact
duplicates, since I am not sure how far back it is
reasonable to expect someone to go to check. 

e.g.

[nigel@localhost java]$ 
[nigel@localhost java]$ less sample.java 
public class sample{
        
  static {
    try {
        System.loadLibrary("NigelzGLPK");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed
to load. \n" + e);
      System.exit(1);
    }
  }
        public static void main(String[] args){
                System.out.println("Nigel is best");
        }
}
[nigel@localhost java]$ 
[nigel@localhost java]$ /usr/java/jdk1.5.0_01/bin/java
-classpath /opt/bsh-2.0b5.jar:. bsh/Interpreter
sample.java 
Exception in thread "main" bsh.Parser$LookaheadSuccess
        at bsh.Parser.<init>(Parser.java:5943)
        at
bsh.Interpreter.<init>(Interpreter.java:175)
        at bsh.Interpreter.eval(Interpreter.java:623)
        at
bsh.Interpreter.source(Interpreter.java:571)
        at bsh.Interpreter.main(Interpreter.java:360)
[nigel@localhost java]$ 
[nigel@localhost java]$ less sample.java 
public class sample{
        
/*  static {
    try {
        System.loadLibrary("NigelzGLPK");
    } catch (UnsatisfiedLinkError e) {
      System.err.println("Native code library failed
to load. \n" + e);
      System.exit(1);
    }
  }*/
  
      public static void main(String[] args){
                System.out.println("Nigel is best");
        }
}
[nigel@localhost java]$ /usr/java/jdk1.5.0_01/bin/java
-classpath /opt/bsh-2.0b5.jar:. bsh/Interpreter
sample.java 
Nigel is best
[nigel@localhost java]$

1657960  Parse error when parsing valid Java code
(2.0b4)  

as shown, nothing which relies on the Java keyword
'static' doing anything, works.


      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/