Issues with the new Script Interpreter

imagej

#1

The major issue for me is that the Fiji-legacy contains the Jython Interpreter and the Clojure Interpreter. The new “Script Interpreter” has a number of issues, e.g. just top of my head, for clojure “(println “hi”)” prints “null”, which indeed is the return type of println, but doesn’t show the actual printed string anywhere on the screen, printing instead to the stdout in the terminal from which Fiji was launched. This trivial issue was many years ago addressed in the interpreters that I had written and that now somebody decided to ditch into the “Fiji Legacy”.


The code weaver to inline java snippets into scripts needs maintenance
#2

You can also view it in the Console window (Window :arrow_forward: Console from the Fiji menu).

It would be possible to integrate another console view with the Script Interpreter, but do you really think it is necessary for the usability of the interpreter? It does show return values directly after all, so you can just write e.g. "Hi" and you’ll see it directly. Do you have a more concrete use case?

What other issues? Let’s solve them.


#3

The issue of printing within the interpreter is easy to solve by redirecting stdout to a PrintWriter that writes to the interpreter.

Other issues:

  1. Fails to keep state, i.e. fails to write the executed commands to a file. The error is puzzling:
WARNING: Couldn't flush user prefs: java.util.prefs.BackingStoreException: /home/albert/.java/.userPrefs/org/scijava/script/_!%g!a@"z!(@!bw"y!(k!.g"v!()!~w!u!(:!}w"p!'o!}@"2!'%!.g"w!'w!d@"n!'k!bg"z!#4!cw"j!()!a@"w!(@!a@"u!'c!.g"j!'w!bw"q!(`!cg"l!#4!@w"s!'8!ag"1!()!~@"^!':!cg"p!(!!d!"&!'4!~w"p!'4!~@== create failed.
  1. The cursor blinks.

  2. When I open a new interpreter, it doesn’t remember the last language that was chosen.

  3. Can’t select commands to re-execute them with e.g. a key binding or a popup menu. I have to select, copy-paste, then push return.

  4. Checking the “Show variable types” doesn’t seem to do anything.

  5. I can’t collapse the table of variables to nothing. Given its apparent uselessness, it is screen noise. In any case it should be fully collapsible.

  6. I have no idea what the list of variables is for or about. Typing the variable into the prompt and pushing return shows that the symbol is not bound to anything (at least in clojure).

  7. The built-in commands e.g. “:lang” should not be bound to a name that starts with “:” in clojure. These can collide with keys for dictionaries. I suggest using something that can’t be bound in any language, perhaps something like what psql (postgres prompt) does: use a leading backslash “\”.

That’s just on top of my head, and I haven’t actually used much this Script Interpreter.


#4

Thanks for the detailed list, @albertcardona. I filed it on GitHub as scijava/scijava-common#308. The GitHub issue trackers are the best place to put bug reports and feature requests like this.

I will try to address these issues over time.