Re:Gosu – A pragmatic language for the JVM
by benjiweber on Thursday July 24, 2014 @03:17PM
(#8081560)
In Java8 you can #!/bin/jjs to start a Nashorn (JavaScript) script running on the JVM.
Nashorn has shell extensions that helps you write shell scripts https://wiki.openjdk.java.net/display/Nashorn/Nashorn+extens...
It's also a great way to bootstrap your Java app with some JSON config http://benjiweber.co.uk/blog/2014/05/08/json-to-java-interfa...
Well, Groovy has done it for a long time ...
#!/usr/local/bin/groovy
@Grab(group='org.springframework',module='spring',version='2.5.6')
import org.springframework.jdbc.core.JdbcTemplate
println "..."
Actually Groovy looks really similar to Gosu and one would argue has a lot wider recognition and support. But then, I do like that Gosu feels much "cleaner" in some way that Groovy doesn't.
Re:Gosu – A pragmatic language for the JVM
by carsongross on Thursday July 24, 2014 @03:01PM
(#8081485)
:)
It's the little things, isn't it?
Regarding JSON support, Gosu has map literal syntax and integrates easily enough with Google's GSON library. Not great, but not terrible.
More speculatively, I put together a type-loader to work with JSON content specified using JSchema:
https://github.com/gosu-lang/Goson
But I'm not sure it works with the current release. (This HN post caught us mid-rework...)
"The classpath can also include Maven coordinates, and Gosu will automatically resolve and download them at runtime:
"Been writing java for 14 years and I've never had a nice way to run scripts.
Now if you can work natively (tougher than folk think) with JSON I'd be very happy indeed. That would include supporting fully de-typed data not nasty schema based data binding. I've switched to NodeJS/JS because they speak the language of the web (not JS, but JSON). But I can't see why other languages can't learn to.