JShell proposal: /exit_if {predicate}

Christian Stein sormuras at gmail.com
Mon May 13 16:03:18 UTC 2019


Hi!

I often find me writing JShell-based scripts like [1] that chain
calls to various tools or functions. To achieve a "fail-fast" on
first error behaviour, I store an "all-is-okay" flag and guard
each tool call by a checking the flag for a zero, indicating all
is still okay, proceed with next call.

It'd be super convenient if there was a JShell command that
wraps that feature. Something like the following pseudo-code:

/exit_if 5 - 4 == 2
/exit_if Files.isSameFile()

Cheers,
Christian

[1] https://github.com/sormuras/make-java/blob/master/build.jsh


More information about the kulla-dev mailing list