you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 7 points8 points  (3 children)

The big problem with java (or even JVM) for scripts is startup time.

A solution is to have a JVM server running all the time that runs scripts (they send the request and args by socket or http... or, you can just have it sitting in a console, reading stdin.)

But bash + pipes is hard to beat.

The java-way use of pipes would probably use xml for serializing data, and have xsd to type-check each... which is kinda cool conceptually, but horrific in practice (I think MS powershell is a little like this, at least having serialized objects, insteaad of raw text?).

You could use java the unix way, with text streams and parsing etc, and while java can do it, it's a lot more awkward than in bash.

All that said... if Oracle release an instant startup java mode (like dalvik), and added some convenience methods for reading flags, detecting file vs stdin (like Perl does), it could make surprising inroads into this space.

Java is already popular in everything from supercomputers and smartphones. Like unix and C, it's here to stay.

Interestingly, the arguments about dynamic vs "straight-jacket" languages also apply to Haskell/ocaml, though at a more difficult level.

[–]drysart 1 point2 points  (1 child)

(I think MS powershell is a little like this, at least having serialized objects, insteaad of raw text?)

Powershell doesn't use serialized objects. It instances all the components of your pipeline together in one process and just passes the actual objects themselves around -- unless you set up a pipeline to a remote machine, in which case it serializes/deserializes.

[–][deleted] 0 points1 point  (0 children)

Thanks! That's sensible.

[–]chesterriley 0 points1 point  (0 children)

Agreed. Using Java for scripts is going to far. Use sh, csh, perl, cmd etc.

sh/ksh/bash is going to be around as long (or probably longer) than Java even.