Monday, July 27, 2009

try/catch/finally/throw

I've been meaning to implement a java style try/catch/finally/throw syntax to xmlsh before I can confidently consider it "robust".

In the unix shells there are signals, and the "trap" command is used to trap signals.
For xmlsh there really is no good concept of signals, but there is java exceptions.
Exceptions are much more useful then signals *and* they are a natural fallout of the types of commands xmlsh was designed for.

So the questions are

Should try/catch be implemented ?
If so should it follow java conventions when possible (try/catch/finally/throw). If not then should it try to simulate the shell's "trap" syntax ? or maybe something different like XProc exceptions.


What should be an error and what an exception? There is a long history in unix shells of using the return value to indicate errors. Should exceptions follow that philosophy? That is, should exceptions only be used in cases where its very difficult to return errors ? Or maybe ALL exceptions should "naturally be trapped" and simply converted to a non-zero error return ?

Sunday, July 26, 2009

Java Scripting ? JSR 223 ?

Java scripting (JSR223) interface for xmlsh ? Useful ? Stupid ?
Inquiring minds want to know !

http://www.jcp.org/en/jsr/detail?id=223


https://scripting.dev.java.net/