This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-08
Channels
- # asami (15)
- # babashka (123)
- # beginners (174)
- # calva (4)
- # cider (6)
- # cljdoc (4)
- # cljs-dev (4)
- # cljsrn (18)
- # clojure (268)
- # clojure-australia (1)
- # clojure-europe (107)
- # clojure-ireland (5)
- # clojure-nl (2)
- # clojure-uk (18)
- # clojured (1)
- # clojurescript (21)
- # conjure (4)
- # cursive (38)
- # data-science (1)
- # datahike (6)
- # datomic (4)
- # events (1)
- # fulcro (9)
- # graalvm (16)
- # helix (6)
- # honeysql (4)
- # instaparse (3)
- # jobs (1)
- # observability (15)
- # pathom (7)
- # pedestal (15)
- # polylith (9)
- # practicalli (1)
- # re-frame (6)
- # remote-jobs (2)
- # specter (7)
- # sql (16)
- # tools-deps (1)
- # vim (5)
- # xtdb (1)
hey all, i have a question about macros in clojure script. why do i need to declare the macros in a clj file first?
Expanding on that… The ClojureScript->JavaScript compiler is a Clojure program. It’s this program that executes the macros that generate ClojureScript output. Once all the macro output has been created, then the combination of the original ClojureScript sources and the macro output can be converted together.
Come to think of it, I just assumed that it was a Clojure program. It runs on the JVM. I guess it could have been written using Java, but I presumed not
it's the same as other compileres. most of the compilers (if not all of them) are written in their language
any idea why?
Well, Clojure didn’t exist when Rich was writing Clojure 🙂 Rich then https://download.clojure.org/papers/clojure-hopl-iv-final.pdf: > Multimethods are quite flexible, and performance is good enough for many applications, e.g., multimethods are used for Clojure’s polymorphic printing. But they cannot be made as fast as Java method dispatch. Thus the initial release of Clojure lacked a sufficient polymorphic dispatch system to define something like Clojure in Clojure. Once Clojure had elements that allowed for the sort of performance necessary, this happened… insofar as ClojureScript was written in Clojure/ClojureScript. A separate project was created, called “https://github.com/remleduff/CinC”. This was then moved into contrib as tools.analyzer, tools.analyzer.jvm and tools.emitter.jvm. But for now Clojure is still in Java, and there hasn’t been pressure to change that.
And if you are thinking about using macros in a self-hosted way, the source code for Klangmeister really helped me out 🎵 https://github.com/ctford/klangmeister/blob/a9cdae2c3d0b71e458576fb693f5cf4654ba73e9/src/klangmeister/compile/eval.cljs
@yairt there is no ClojureScript runtime - thus the compiler is not available in the execution environment
the reason for this design is that the web is desirable target - and including the compiler in the runtime is quite heavy
Cljs.main question - How to run cljs.main on a remote cloud server, for example a Digital Ocean linux droplet, and connect to browser on local PC?
did you solve your issue?
I was able to get it to work with figwheel.main but not cljs.main. "$ clojure -m figwheel.main" on the remote machine, ssh port forward tunnel for browser connection from PC to remote machine, browser loaded the page and connected to the remote repl. With cljs.main the browser connected but the repl would hang at that point and not get to prompt for input. Thanks.
hmmmm. can you access the repl via ssh?
Does anyone have an example of exporting a default ESM module from a ClojureScript file in any tooling? (shadow-cljs, figwheel, etc)
did you solve your issue?