From: Peter C. <cen...@ri...> - 2002-11-03 20:46:13
|
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 |
From: Brian S. <bs...@bs...> - 2002-11-03 20:59:45
|
On BeanShell: The first prototype of an interpreter-based REPL for DrJava that I did was actually based on BeanShell. I switched to DynamicJava for reasons I don't remember at the moment -- it might have been language feature support they had at the time, perhaps lacking anonymous inner classes or something. Or it may have been an ease of integration issue, or even licensing at that time (I think they used to have a different license). Anyway, BeanShell is certainly a more living project than DynamicJava and it sounds like it has improved some since I last checked it out. It sounds like not a bad idea to move to it, although the range of improvements sound like it wouldn't be worth your effort to spend too much time on it. On the other hand, it shouldn't be too hard to implement. The REPL was designed from the beginning to allow swapping out the interpeter. Pretty much, you should be able to implement model.repl.JavaInterpreter and swap that in instead. (I think there is a bit of DynamicJava-specific code in other places, like handling the returned values/error messages, but it shouldn't be hard to clean up.) One small concern to point out: Seems like they blew it with regard to returning the "no result" value, like DynamicJava did (before I fixed it in our subclass). From their docs: If an evaluation of a statement or expression yields a "void" value; such as would be the case for something like a for-loop or a void type method invocation, eval() returns null. This same problem in DynamicJava was the reason, if you left off the semicolon, you used to get "null" as the result for void-returning statements. Anyhow, just wanted to throw in my few cents. -brian |
From: Eric A. <eri...@ma...> - 2002-11-04 01:08:51
|
One thing to keep in mind: we should soon be extending the interpreter to handle NextGen-style generics. That will entail (1) mangling/demangling of type identifiers, and (2) a modified class loader. We need to assess how easy both of these things will be with BeanShell vs. DynamicJava. I'd expect it shouldn't be very hard in either case, but we need to keep it in mind. -- Eric On Sunday, November 3, 2002, at 02:46 PM, 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 |
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 |