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

>You basically write ClojureScript in JavaScript syntax.

Why?



sort by: page size:

> it is the clojure language that compiles to JavaScript, usually for running on the front end.

Being super pedantic (probably unnecessarily), it's the Clojure syntax for a subset of the Clojure language, plus some additional syntax and functionality specific to JavaScript interop.


> ClojureScript is a compiler for Clojure that targets JavaScript. [1]

If ClojureScript is compiled, why can't WASM be the same?

[1] https://clojurescript.org/


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...


> If you have worked on any sizeable JS code base, you have probably dealt with some of JS’s language quirks such as function context (this), hoisting, prototype inheritance, number array sorting, and the list goes on….

so clojurescript is just another language for people who don't want to bother learning javascript?


Does anyone know what this means for clojurescript?

Interesting. I haven't used ClojureScript.

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

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


There have been a couple of comments here asking a question like this, and it makes me realize that most people don’t actually know what clojurescript is.

Clojurescript is not some kind of scripting language on top of clojure, it is the clojure language that compiles to JavaScript, usually for running on the front end.


Sorry for what might be an obvious answer, but when you say

>because the standard clojurescript library has everything+

do you mean bc it has all those libraries incorporated, or bc it's able to emit the equivalent to native javascript?


"So, I decided to implement a simple version of Clojure that compiles to Javascript and can be run on top of nodejs."

Did you know that Clojurescript can run on node.js? https://github.com/michaelsbradleyjr/node-clojurescript

Cool project though!


my view is the opposite, ClojureScript is more permissive than Javascript :/

Neat. Why would I use this over ClojureScript or Parenscript?

That's not what he said:

aka. Clojure (...) compiled to JavaScript

You stopped reading a few words too soon :)


This is a good time to mention that Clojure has ClojureScript, which is the full language hosted on JavaScript, and compiled using Google Closure (sigh about the naming confusion) advanced compilation mode, with dead code elimination and full-program optimization.

[context: I used to write in CL and used Parenscript before I switched to Clojure]


> What do most here use Clojure for?

That's to evade having to use Java, Scala or Kotlin.

Clojurescript: because it's the easiest (compared to Elm, Purescript and Rescript) to call JS.


What about ClojureScript?

What about clojurescript?

This is Clojure, not Javascript though.

However, since ClojureScript transpiles to Js I don't really have to care about this do I. From my perspective Js is effectively bytecode.
next

Legal | privacy