Fork me on GitHub
#clojurescript
<
2019-04-10
>
grav13:04:44

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.

lread16:04:47

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.

ballpark16: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'

ballpark17:04:53

figured it out. nevermind

ballpark17: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/analyze-str
      (c/empty-state) "(+ 1 2)" nil {:eval c/js-eval :context :expr} identity)
and it's returning nil instead of an AST.

lread17:04:48

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

😂 4
thheller17:04:47

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

4
mfikes18:04:31

@jpsoares106 the online example was incorrect and was updated with https://github.com/clojure/clojurescript-site/commit/9feab29728cb195f3fab67164465ae7d129b5bf7 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:

lread22:04:12

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.

darwin22:04:19

@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?

lilactown22:04:46

:thinking_face: do reader conditionals work in macros?

alexmiller22:04:15

reader conditionals are about reading

lread22:04:20

I will check that our @darwin, thanks.

lread22:04:18

Hmm… I will take a peek, thank you.

lread00:04:13

It looks like macrovich is using a similar technique https://github.com/cgrand/macrovich

alexmiller22:04:27

macros are about writing code

alexmiller22:04:24

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

lread22:04:54

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

lread22:04:31

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

lread23:04:47

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