Re:How to Use Clojure for Scripting
by winterlight on Friday December 09, 2016 @07:52AM
(#13138449)
What bothers me most about clojure is the abstraction leak when it comes to errors. When something goes wrong (say you passed a value of wrong datatype to a function), it just spits a java error stack. I'd like to have feedback closer to the conceptual level of the language, than to the intricacies of the run-time.
Spec instrumentation solves this perfectly for Clojure and ClojureScript. There's a price to pay, sure. Namely speccing your functions, but specs are defined for the functions in clojure.core.
I am curious is this true for all other JVM-hosted languages as well?
I've only ever been exposed to Clojure. Does Scala and JRuby have this as well?
If you think Clojure has too much startup overhead for scripting, maybe Pixie[1] will pique your interest.
Here's a wonderful talk to introduce its design and value https://www.youtube.com/watch?v=1AjhFZVfB9c
If I could simply `apt-get install pixi-lang` or `brew install pixi-lang` I'd be using it.
Thanks, hadn't seen that, but am going to check it out.
For me, Racket is the sweet spot. It has a surprisingly good story for a lot of use cases, good included batteries, truly great documentation, static typing when you want it, the ability to make a redistributable native(-looking?) GUI app, better-than-python/ruby/other interpreted languages performance, etc.
I do like some of Clojure's syntactic sugaring, but I haven't yet decided whether it's worth it to me to use Rackjure (Clojure-isms ported to Racket).
i always feel like racket just ultimately fails at self promotion
If the JVM or the startup time bother you you can try using ClojureScript with node.js.
> I want to like clojure. I've always had a soft spot in my heart for lisp
Have you tried Racket?
Re:How to Use Clojure for Scripting
by Johnny_Brahms on Friday December 09, 2016 @09:19AM
(#13138848)
As a racket user I wouldn't say racket is a good scripting language unless you use racket/base and manually require the extra cruft. Startup is quite darn noticeable even on my relatively fast ssd-equipped laptop. For small scripts the startup time is often by far the largest part of the total run time.
But yeah, racket is fun.
As a scripting language the startup is a pain (It has been getting much needed attention just this past month and they are seeing a big improvement on that)
In terms of having a soft spot for lisp and clojure I find that Racket is the best thing ever for scratching that itch. I really am excited by clojure for scripting though.
Racket Scripting https://docs.racket-lang.org/guide/scripts.html
Certainly many little tricks to help with speed.
I'm (mostly) kidding...
I want to like clojure. I've always had a soft spot in my heart for lisp, and clojure seems to be the best contender for hitting the right balance between the classic "no syntax at all, just more parens" and various more modern takes on "It's lisp, but with our own weird syntax bits layered on." Unfortunately the JVM'ness of it has shown through so much as to kind of turn me off. (Not least of all the overhead of starting a JVM to do anything.)