From: Charles R. <cr...@ri...> - 2002-11-18 00:15:46
|
I've been looking at BeanShell this weekend to see if it would be a good replacement for DynamicJava. Although there are a lot of nice features (like the import thing Peter mentioned), there still appears to be a huge problem: you cannot define classes in the interpreter using Java (as far as I can tell). BeanShell provides support for "scripted objects" and even implementing a form of anonymous inner classes, but these do not use real Java syntax. For example, to create an ActionListener, you would say: buttonHandler = new ActionListener() { actionPerformed( event ) { print(event); } }; Note that typing "public void actionPerformed(ActionEvent event)" gives you a syntax error. Being able to define classes and implement interfaces is a pretty big selling point for us, and we don't want to have to teach it in another language/style. While the Strict Java mode appears to be ideal for us for statements and expressions, I think switching over to BeanShell would still be a huge step backwards if we had to give up dynamic class definitions. Of course, DynamicJava has it's own (fairly large) set of quirks and missing features, but I think it might be good to stick with it for now. If BeanShell ends up adding support for classes in their Strict Java mode, then I'm in favor of switching (especially since BeanShell is a significantly more active project). Charlie ps-- If I'm mistaken and there is a way to do it, please let me know! Peter Centgraf wrote: > I just took another look at BeanShell, a java-like scripting environment > very similar to DynamicJava. The website is here: > > <http://www.beanshell.org/> > > BeanShell has recently added a few features which would be of interest > to us for DrJava. In particular, there is a new "Strict Java" mode, > which forces all variable declarations to be typed and all script > statements to have Java-legal syntax. If I remember correctly, this > feature has already been requested for consistency reasons for teaching > in DrJava. In normal mode, BeanShell will use DJ-style loose typing, as > well as automatic boxing and unboxing of primitives and an enhanced > print (i.e. System.out) mechanism. > > Another feature that would be handy for newbies is a "global import" > statement: "import *" which maps out the entire classpath. Ambiguities > in naming caused by the global import will be reported at runtime and > can be corrected with (an) additional import statement(s). This is > coupled with a "which" command that prints the exact filesystem location > of any known Java identifier. Considering the amount of difficulty that > new students have in understanding the classpath rules, this could be > extremely helpful. > > BeanShell already ships with a Swing-based console which integrates via > I/O Streams or a custom interface, complete with history completion. We > could also use a lower level of integration with the engine if we chose, > a la DynamicJava. Everything is LGPL, so we'd have full access to the > code and it would be compatible with our license. > > The last advantage would be consistency with other similar tools. The > Emacs JDE already integrates with BeanShell, and Sun is planning to use > it in a future version of Forte and the NetBeans IDE. As far as I can > tell, DynamicJava is a strict subset of BeanShell, so there's little > reason to hold out with an unpopular technology. > > Obviously this would take a significant amount of work, but I think it > would be a worthwhile venture. What opinions are there from the other > developers? > > -- > Peter > > > > ------------------------------------------------------- > This SF.net email is sponsored by: ApacheCon, November 18-21 in > Las Vegas (supported by COMDEX), the only Apache event to be > fully supported by the ASF. http://www.apachecon.com > _______________________________________________ > drjava-hackers mailing list > drj...@li... > https://lists.sourceforge.net/lists/listinfo/drjava-hackers |