Fork me on GitHub
#clojurescript
<
2015-08-28
>
tel00:08:24

Is there a way to have closure-defines pull from the environment?

tel00:08:50

something like :closure-defines {my-def #=(System/geteng “MY_DEF”)}?

rauh00:08:10

leiningen should be able to do an eval like that. Yeah

tel00:08:17

alright, I’ll test it out

tel00:08:34

seems like there’d be something more natural than to pull out the eval hammer

tel00:08:04

oh, that blew up fast

tel00:08:11

can’t reference System?

tel00:08:10

does :env/what-have-you work everywhere?

tel00:08:57

is it intended behavior that (goog-define x nil) fails to compile?

dnolen01:08:51

@tel not supported the docstring states what is allowed.

tel03:08:09

this might be a dumb question, but I can’t even offhand find the docstring for goog-define

tel03:08:22

I was running off of @martinklepsch’s blog post

martinklepsch07:08:18

@tel I should add a link to the source to the blogpost probably

akiel08:08:55

does someone use figwheel with cursive repl? css reloading doesn’t work for me.

gerrit09:08:55

I just tried that, and here it worked

gerrit09:08:21

after I changed the css rule that actually applied to an element on the page simple_smile

gerrit09:08:59

but I am having an issue with goog.History:

(goog.History. )
ExceptionInfo #<TypeError: goog.History is not a constructor>

gerrit09:08:18

has anyone experienced that before?

gerrit09:08:48

@akiel: actually no. I just uncommented the :nrepl-port in the project.clj and then added dev to the src-paths. then I start the cljs repl using this:

(ns user
 (:require [figwheel-sidecar.repl-api :as rapi]))

(defn cljs-repl []
 (rapi/cljs-repl))

Pablo Fernandez10:08:00

I’m running figwheel with a ring handler, is this using jetty?

gerrit10:08:28

don't know. it uses what lein figwheel uses

gerrit11:08:20

@darwin: thanks, for some reason it stopped complaining about that typeerror after a couple of restarts ?!??!!

rauh12:08:34

This is exciting (note the last commit): https://github.com/ohpauleez/cljs-terra

cfleming13:08:10

@rauh: Nice, CLJS-terra is an interesting project

akiel14:08:33

@gerrit can you point me to a complete project.clj? It doesn’t work for me.

gerrit14:08:03

then just run lein figwheel

gerrit14:08:48

and in cursive use a remote repl with hostname localhost and port 7888

akiel14:08:12

yes lein figwheel worked for me in the past already - but I like to execute code from within the editor in the repl which does not work with lein figwheel

akiel14:08:32

ok I will try the remote repl

akiel14:08:04

@gerrit: ok it works - thanks

gerrit14:08:38

:thumbsup:

timgilbert15:08:50

Hi all, can someone spot what’s wrong with this conditional statement I’m trying to use?

(ns foo.schemas.core
  (:require [schema.core :as s]
            #?(:clj [clojure.tools.logging :as log])))
Seems to work fine on the Clojure side, but with ClojureScript 1.7.107 I keep getting compile errors about being unable to find clojure.tools.logging

timgilbert15:08:37

(I’m trying to not include it in ClojureScript)

timgilbert15:08:48

Aha, think I figured it out… The error was actually coming up from a Clojure compilation of this file within my CLJS project, because I had it under :source-paths

timgilbert15:08:29

…and I don’t have that dependency in the cljs project. Thanks and sorry for the noise!

sekao16:08:47

does anyone know if there is a something i need to do to get CLJS to output code that can run without a DOM? in my case, i want to write a web worker. my attempts are failing because there are references to window in my CLJS output.

darwin16:08:25

@sekao: people wrote web workers successfully with CLJS before, maybe you are including some DOM-related library to your web-worker project?

meow16:08:58

I've made more progress on my L-System code and now have what I believe should support every variation of L-Systems you could want - deterministic, stochastic, context-sensitive, parametric, combinations of all of the above. https://github.com/decomplect/ion/blob/master/src/ion/ergo/l_system.cljc

meow16:08:52

I'm not 100% sure about the API and code, so if anyone wants to check it out and provide feedback/suggestions that would be great.

meow16:08:48

For example, is there a more idiomatic way of handling the need to look at the previous and next values in a collection when processing that collection? I just did a (map vector (range) coll) over the collection and then in the handler I did (replacement v (get coll (dec n)) (get coll (inc n)))

darwin16:08:05

@sekao: you can maybe get some inspiration from my project here: https://github.com/darwin/plastic/blob/master/cljs/project.clj#L95, I had to employ quite some hacks to get it working (re-frame, depends on reagent, which in turn includes react.inc.js), but it could be much simpler in your case, if you don’t have such deps and don’t need to depend on :closure-defines feature

sekao17:08:44

@darwin the only library i’m using is schema. however i am using cljs.js/eval in my worker. i assume that doesn’t need the DOM.

darwin17:08:22

@sekao: are you compiling as :nodejs target, right? you should dig into the output and find out what is responsible for those window references

sekao17:08:07

@darwin i’m not using that target. is it just :target :nodejs in the compiler options?

darwin17:08:43

yes, AFAIK

darwin17:08:18

maybe it is possible to compile with default web target as well, I’m not sure, I did :target :nodejs

sekao17:08:47

@darwin the output with that has unexpected tokens. did you have to modify the JS output to get it to work in a web worker?

sekao17:08:56

it even outputs #!/usr/bin/env node at the top, is that even valid for a web worker script?

dnolen17:08:36

@cfleming: not sure what’s going on but the latest release is unusable for me, doing anything at the REPL locks up IntelliJ completely

sekao17:08:35

@darwin i may have miscommunicated, but i’m trying to run CLJS in a web worker inside a browser, not on nodejs, so i don’t think the :nodejs target will work for me

jeluard17:08:05

@sekao: there’s an old ClojureScript library related to web worker, it might give you some hints: https://github.com/MarcoPolo/servant

cfleming17:08:29

@dnolen: That’s weird, does going back to 0.1.59 fix it? No-one else has reported anything.

dnolen17:08:02

@cfleming: going back to 60 fixes, 61 does not work for me

sekao17:08:50

@jeluard i tried that library but so far i’ve been using the web workers api directly so far since it’s so simple. i think my issue is about the CLJS compiler itself though.

cfleming17:08:15

@dnolen: Oh, the one right now. That’s very strange, there are only minor fixes in there. I’ll check ASAP. Doing anything in a CLJ clojure.main REPL, right?

dnolen17:08:12

@cfleming: not sure about doing any thing, just the project I was in which is not shareable. In the middle of work so didn’t investigate more.

dnolen17:08:33

@cfleming: but intellij became completely unresponsive

dnolen17:08:35

tried it 3 times

cfleming17:08:42

@dnolen: Ok, I’ll try to reproduce.

dnolen17:08:42

same result, could not even quit

dnolen17:08:57

had to force quit, and there were orphaned java processes that I had started

cfleming17:08:30

Ok, that’s very strange. Thanks for the report, I’ll take a look this evening.

dnolen17:08:31

the project I’m using is heavily multithreaded, no sure if that’s a clue for you

cfleming17:08:44

@dnolen: Not sure, I’ll see if I can see anything obvious. If I can’t reproduce I’ll get a thread dump from you when you have some time.

tel19:08:52

Anyone seen No implementation of method: :-compile of protocol: #'cljs.closure/Compilable found for class: nil in clojurescript 107?

cfleming20:08:48

@dnolen: Ok I think I know what the problem is. I changed one of the regexes for stacktrace matching and I think the new one is prone to exponential backtracking. That matching happens on the EDT and would lock the IDE.

cfleming20:08:04

@dnolen: Which IntelliJ version are you running?

tel20:08:28

oh, nm, that was dumb… misspelled my main namespace

cfleming20:08:56

@dnolen: There’s a test build here: http://colinfleming.net/regexp/cursive-14.1-0.1.61.zip with that change backed out. A couple of other people have had the problem and will hopefully try to reproduce, but if you get time to try it that would be excellent.

cfleming20:08:46

@dnolen: Ok, never mind - another user has confirmed that the test build fixes the issue. I’ll do a release now.

cfleming21:08:34

@dnolen: Fix is out now in 0.1.62

cfleming21:08:04

Time to change regexp implementations.

pandeiro22:08:23

does one have to (:require-macros [cljs.core :refer [goog-define]]) to use that? with 1.7.48 I get WARNING: Use of undeclared Var ...

dnolen23:08:23

@pandeiro: goog-define is in cljs.core

dnolen23:08:41

you never have to require anything in cljs.core

pandeiro23:08:57

that's what i thought too, but that's the error i get

pandeiro23:08:33

@dnolen: getting this with :classifier "aot" (WARNING: Use of undeclared Var foo.core/goog-define at line 11 /.boot/cache/tmp/app/1/7o2s6s/foo/core.cljs) but not otherwise