Fork me on GitHub

Where do you people go and discuss web-technologies (eg Service Workers and PWA’s)? Are there any good channels on this Slack, or do you use other Slacks?

Jp Soares14:04:02

Good question. I don't know. I'm also interested in this subjects and I usually look in #clojurescript for more broad web content.


Hello ClojureScriptians! I love that a cljc test can now simply (:require [clojure.test :refer [deftest is testing run-tests]]) without reader-conditionals. I’m trying to figure out how to do the same under the following scenario: let’s say I have macro bar, its clojurescript version foo-cljs/bar in foo_cljs.clj and its clojure equivalent foo-clj/bar in foo_clj.clj. How do I get to being able to (:require [foo :refer [bar]])? I’ve taken a stab at adding a foo.cljc that requires my bars in various ways, but as I flail, I am thinking one of you clever people knows the path.

Frank Henard16:04:29

I'm trying to create a cljs project that targets nodejs as directed by the current quick start guide. I've installed express, but when I run the repl with java -cp cljs.jar:src cljs.main --repl-env node, then do (require '[my-ns.core :as myns]), I get Cannot find module 'express'

Frank Henard17:04:53

figured it out. nevermind

Frank Henard17:04:36

related: should I use shadow-cljs instead of plain deps.edn?

Jp Soares17:04:36

I found a regression related to cljs.js/analyze-str, It's not working since 1.10.238 (maybe even before). I'm trying to run the following in the CLI repl:

(require '[cljs.js :as c])
      (c/empty-state) "(+ 1 2)" nil {:eval c/js-eval :context :expr} identity)
and it's returning nil instead of an AST.


thanks @john, I will re-read that nugget from @mfikes and see if I can get to an unflailing state. 🙂

😂 4

@jpsoares106 pretty sure that is intended. it must be able to go async so the identity as a callback won't really work


@jpsoares106 the online example was incorrect and was updated with It is the case that this used to work accidentally but that wasn’t the intended use.

Jp Soares18:04:54

It works! Thank you very much 🙏:skin-tone-5:


The macro sugar seems pretty clear if there is one macro for clj and cljs, but I still haven’t figured it out if I have a separate clj and cljs implementation for my macro. I should really maybe just go over and study how it was done for clojure test.


@lee hmm, don’t you just need to detect current compilation environment in your macro and decide what to generate based on if the macro was called from cljs or clj?


:thinking_face: do reader conditionals work in macros?

Alex Miller (Clojure team)22:04:15

reader conditionals are about reading


I will check that our @darwin, thanks.


Hmm… I will take a peek, thank you.


It looks like macrovich is using a similar technique

Alex Miller (Clojure team)22:04:27

macros are about writing code

Alex Miller (Clojure team)22:04:24

In cljs, when macros are run, you are in a Clojure program (the cljs compiler)


Thanks @alexmiller, I think I got too fixated on this reader conditional-less require syntax. I should probably stop. The macros I am writing do some digging and manipulating (clj version uses resolve and cljs version uses the cljs.analyzer.api).


They work, I just wanted to :require them from cljc like I do :requires for test from cljc - without reader conditionals.


Sometimes a git reset HEAD --hard makes sense. 🙂