Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

That's a bug in the JS interpreter they're running, not anything related to Clojure. Also, that's not a syntax error


sort by: page size:

It shows, interestingly, a ClojureScript error for me.

This is Clojure, not Javascript though.

I'll look into fixing then. Do you have any suggestions for good syntax highlighting to use from either clojure or javascript?

You seem to have no idea what you're talking about. There are actually fewer parentheses in Clojurescript than in the similar code in JS+JSX.

>You basically write ClojureScript in JavaScript syntax.

Why?


Maybe ClojureScript is doing something Clojure doesn't at compilation time…

Thanks, it makes sense now also thanks to brehaut's comment. I hadn't realized it actually _is_ a Clojure implementation in JavaScript.

Edit: Actually that's not strictly true. "What ClojureScript is Not" https://github.com/clojure/clojurescript/wiki/Core-blog-post...


I suppose Clojure devs needn't learn ClojureScript anymore. ;)

That has more to do with Javascript being weird than Clojurescript. That would almost certainly throw a good exception when using Clojure / Java.

Well... then you're writing Clojure/Lisp, not JavaScript.

Nothing wrong with that as such but it's a completely different thing.


Cool. This explains why the better I understood Clojure, the more my Javascript started to look lispy.

Does anyone know what this means for clojurescript?

Clojurescript is not "also known as" Clojure.

It's not a javascript compiler as Clojure is a hosted language.

(+ 1 “1”) is not a type error for CLJS, because it’s not a type error for JS. Clojure is designed as a hosted language and it shares all the basic types and operations with the host platform.

That's not what he said:

aka. Clojure (...) compiled to JavaScript

You stopped reading a few words too soon :)


Clojure is a functional language, so it meshes well with the rest of the syntax, but in javascript's case it's just syntax bloat. It's going to be really jarring in the middle of regular imperative code, and it's not going to be too far removed from

  cout << "foo";

That was not my experience with Clojurescript. I might have to try it again.

I’m not super familiar with Clojure, but I tried to read through the link you shared. I certainly could be missing something, what can Clojure’s destructuring do that JavaScript cannot?
next

Legal | privacy