3 ms·
You mentioned that you wanted something non-hosted. Unless I missed it, the arguments are roughly performance (not really made) and visibility (not true, see [1
by lvh 10y ago
You mentioned that you wanted something non-hosted. Unless I missed it, the arguments are roughly performance (not really made) and visibility (not true, see [1]). Hosted versus non-hosted seems like a property without a particular intrinsic value judgement. I'm going to argue that for a Lisp, being hosted is a great idea.
Firstly, JS is a very credible and easy to use target for Clojure. It has source map support and produces aggressively optimized JS via the Google Closure compiler. (Parenscript, the CL competitor, can claim neither.) I've had plenty of code where I literally rename the "clj" extension to "cljc" and it magically runs in the browser.
Secondly, I get to use ample libraries in both cases because they already have thriving ecosystems that are completely independent from all of these parentheses. For example, today I'm writing AWS code, and I get to use AWS's Java SDK painlessly. If I'm on CL, it appears I'm out of luck.
Being a hosted language, in and of itself, hence seems like a clear choice if it isn't for the (not made) performance argument. So, perhaps we should talk about that instead :)
[1]: https://news.ycombinator.com/item?id=13349747 https://news.ycombinator.com/item?id=13349747
- junke 10y agoSee ABCL (http://abcl.org/ http://abcl.org/) and JSCL (https://github.com/jscl-project/jscl https://github.com/jscl-project/jscl)
- lvh 10y agoJSCL is quite different from ClojureScript. ClojureScript has a self-hosted form (which, AFAICT, is the default for JSCL), but that's not what you want for most applications if you want to produce efficient minified code. My two specific claims about ClojureScript being good included source maps and aggressive optimizations (and all of the cool side effects from having Closure as your module system) -- neither applies to Parenscript (as I mentioned) or JSCL.
- lvh 10y agoSome Java: public class Main { public int addTwoNumbers(int a, int b) { return a + b; } } Calling it from ABCL: (defun void-function (param) (let* ((class (jclass "Main")) (intclass (jclass "int")) (method (jmethod class "addTwoNumbers" intclass intclass)) (result (jcall method param 2 4))) (format t "in void-function, result of calling addTwoNumbers(2, 4): ~a~%" result))) Calling it from Clojure: (defn f [] (prn "calling addTwoNumbers from f" (.addTwoNumbers (Main.) 2 4))) Note that the Clojure version creates the object, and the ABCL version doesn't do that for you; you still need to instantiate a Main yourself. Also, my concrete claim was that I could use AWS easily. I can use both the SDK directly quite painlessly (see above) or use https://github.com/mcohen01/amazonica https://github.com/mcohen01/amazonica. Where is the equivalent CL library?
- junke 10y agoUse JSS (http://abcl.org/svn/tags/1.3.0/contrib/jss/README.markdown http://abcl.org/svn/tags/1.3.0/contrib/jss/README.markdown): ;; During initialization (require 'abcl-contrib) (require 'jss) Then, for example: CL-USER(1): (in-package :jss) JSS(2): (lambda (x y) (format t "~&addTwoNumbers(~A, ~A): ~A~%" x y (#"addTwoNumbers" (new 'Main) x y))) #<FUNCTION (LAMBDA (X Y)) {7EEE31B2}> JSS(3): (funcall * 20 30) addTwoNumbers(20, 30): 50 NIL The same goes for any Java library. As for AWS, I have no experience with it. Looking around, there seems to be https://github.com/hargettp/hh-aws https://github.com/hargettp/hh-aws. Btw, I am not attacking Clojure, but the idea that Clojure is the only useful Lisp available on the JVM.
- lvh 10y agoThat is a lot better, thanks. hh-aws is unmaintained and only supports a tiny, tiny fraction of AWS.