Fork me on GitHub
#clojurescript
<
2018-03-13
>
felipebarros03:03:02

I'm trying to follow the new version of the ClojureScript Quick Start guide at https://github.com/clojure/clojurescript-site/blob/96cdf27ff1a2a836ae4f7c706e48a0bff21e95a0/content/guides/quick-start.adoc, but I get the following error after issuing clj --main cljs.main --compile hello-world.core --repl:

Compiling client js ...
Serving HTTP on localhost port 9000
Listening for browser REPL connect ...
Exception in thread "main" java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper
Which I believe is due to the fact that I'm running this inside a Docker container. I have tried to look at the official guide and reference on http://clojure.org and the clj --help output but nowhere I've found a mention on how to make it not try to launch the browser automatically (headless).

felipebarros03:03:27

Hmm.. I guess the problem is that I'm specifically asking for a --repl and in the context it seems to take for granted that it is a browser repl.

john03:03:28

you want to use a headless repl environment

john03:03:48

clj -m cljs.main -c hello-world.core -re node -r

john04:03:52

not sure if the quickstart works with node though... js/alert won't be there, etc.

john04:03:32

ah, there's details on node towards the bottom of the quickstart

felipebarros04:03:31

Yeah, I just assumed it would have the option to open the browser myself like lein. Thanks @john.

gonewest81804:03:37

I’ve noticed you asking docker questions here and in #docker, and honestly I recommend running the development tools directly on your machine at least until you’ve worked through the quickstart and have some experience with the toolchain. Then when you come back to running things in Docker you’ll at least know what it looks like when things work as they should.

john04:03:07

@anantpaatra clj -m cljs.main -c hello-world.core -ro '{:launch-browser false}' -r

john04:03:56

Then you could connect to it from a phantom instance or something

felipebarros04:03:14

Thanks @gonewest818, I'll take that into account. I've had the tools locally for a long time, and have been in and out of Docker, so I'm forcing myself to go the hard way and figure how things would work with Docker now that I need to co-op with a friend who is also learning.

felipebarros04:03:28

@john I'll try that! Thanks again.

john04:03:17

Are you pushing a jar into the docker?

john04:03:19

I guess as long as you can get clj tool in there

felipebarros04:03:32

No, haven't tried that. Just trying to build a simple cljs setup that I can share with my friend.

felipebarros04:03:49

And trying the new cli-tools in this case.

felipebarros04:03:37

Clojure tooling in general have posed as hard obstacles to me (no programming background), even more than the language, so trying to understand what the new tools are doing that may facilitate things my way.

john04:03:54

Nice, well I doubt many have treaded your ground, with this trifecta of docker, clj tool and the new cljs.main, so it'd be interesting to read up on your experiences.

felipebarros04:03:02

I must write about it indeed. I believe the language itself is very appealing to someone who likes elegance and minimalism in code. Front-end developers trying to learn back-end or reactive front-end, especially those who study alone, have a tendency to find the ground in the CLJ/CLJS community really tough because people have a really robust background here. I'm still learning but I'm figuring things out at a faster pace now, maybe it can help others in a similar situation.

felipebarros04:03:27

We've discussed a bit about this in the new #programming-beginners channel. How the language feels just right and gives us a lot of "wow" moments, but the tooling and the ecosystem are still really harsh for non-programmers.

john04:03:27

The tooling is still evolving towards becoming as easy and elegant as the language itself.

felipebarros04:03:14

This is why I'm really interested in the new official tools.

felipebarros04:03:56

This new guide is very refreshing and simple compared with most others. I guess the mindset in the community is going the right way and that feels awesome.

yogthos17:03:14

@dnolen @mfikes so this doesn't seem right to me (let [v-1 1 v_1 2] [v-1 v_1]) => [2 2], ran across it here https://mastodon.social/@Treppenwitz/99677541702540966

rauh17:03:17

@yogthos I logged that somewhere... Let me find it

rauh17:03:44

Almost looks like the tweet copied my examples 🙂

rauh17:03:48

The straightforward fix is easy.. But would slow down compilations A LOT

richiardiandrea17:03:40

well would a warning work?

rauh17:03:17

Same complexity... The right approach is to store "starting ns + bindings" munged in a separate set. That'd also speed up compilation (possibly by a lot).

rauh17:03:31

Related: Personally, I want to push to emit ES6 const + let instead of vars all over the place. Would make this at least fail fast instead of fail silently. And would simplify the compiler a bit, generate faster + smaller code (so: Many wins)

justinlee18:03:21

wow i’m surprised that is consider minor defect. it’s the kind of maddening thing that could burn a ton of time.

yogthos18:03:00

yeah it's not obvious behavior by any means, and most people coming to Clojure are likely to be used to using _ instead of -. I've seen people mix the two commonly as they transition to using dashes.

justinlee18:03:58

with no warning or error it would be a terrible thing to try to debug

danielcompton18:03:07

Is it possible to use closure-defines at macro expansion time?

rauh18:03:13

@danielcompton No but you can just emit code that checks them (with identical? probably) and rely on DCE

danielcompton18:03:54

thanks, I thought that might have been the case. Makes the macro a bit trickier to write

Garrett Hopper18:03:57

In a cljs node repl, I can require node modules easily, but when I try to require a namespace that requires node modules, it can't find them. (The error message also seems like the quotes are removed from the require.) Any ideas?

Garrett Hopper18:03:11

I don't get

java.lang.AssertionError: Assert failed: cljs.analyzer/foreign-dep? expected symbol got "non-existant"
(symbol? dep)
but
clojure.lang.ExceptionInfo: No such namespace: cookie, could not locate cookie.cljs, cookie.cljc, or JavaScript source providing "cookie" in file /data/prs/boot/cache/tmp/data/prs/dev/amazon/bi1/-ru88jt/userinfo/core.cljs {:tag :cljs/analysis-error}
when requiring the namespace.

Garrett Hopper18:03:24

I've even added :path ["node_modules"] to the node-repl/repl-env call.

Garrett Hopper18:03:29

Similarly calling load-file through emacs doesn't work, but manually evaluating the ns form of the dependency file then the ns form of first file (which refers the the other namespace) works.

Garrett Hopper18:03:55

If I manually call (require '["module"]) for each of the modules from the cljs.user namespace, I can then require the namespace that requires them. Perhaps this has something to do with my using a boot repl since it runs from cache folders?

richiardiandrea19:03:04

ClojureScript question, does cljs.test/testing work with async tests?

richiardiandrea19:03:09

I am printing :testing-contexts it in a defmulti but it always seems to be empty

richiardiandrea19:03:38

wanted to ask here first before working on a repro

Garrett Hopper20:03:51

This is driving me crazy. Apparently the node cljs repl supports importing arbitrary modules from node_modules via require, however it doesn't when loading a file (typically by requiring a namespace that requires a module).

dnolen20:03:12

@ghopper first thing I would do is check that this works with ClojureScript itself to eliminate other variables

dnolen20:03:34

there might be REPL bug here of some kind - I wouldn’t that surprised

Garrett Hopper20:03:52

@dnolen Check that what works with ClojureScript? As in no in building instead of a repl?

dnolen21:03:36

no I mean I don’t know how you’re running a REPL

dnolen21:03:50

but if by some other means other than ClojureScript it muddies the waters

Garrett Hopper21:03:49

@dnolen Oh, I am directly running cljs.repl/repl, if that's what you're saying. Along with a cljs.build.api/build prior to it with the same :output-dir. (I'm still not sure how this works) I'm putting together an example project now.

dnolen21:03:15

well that’s a lot of details we might not be interested in

dnolen21:03:44

if there’s a minimal case where the REPL won’t load some node modules then just report that

Garrett Hopper21:03:08

Will do. I'll post the minimal case.

Garrett Hopper21:03:58

@dnolen How should multi-file clojurescript issues be formatted and where should they be submitted?

Garrett Hopper21:03:07

Perhaps a Github gist or something?

dnolen21:03:14

everything inline in the issue

dnolen21:03:37

if it’s minimal this is easiest

Garrett Hopper21:03:25

As a Github issue? I'm not seeing an issues link as with most projects, and /issues takes me to pull requests.

dnolen21:03:03

yes pelase

Garrett Hopper21:03:55

@dnolen It's created. I'm not sure it's in the correct format though: https://dev.clojure.org/jira/browse/CLJS-2659