Fork me on GitHub
#clojurescript
<
2018-12-20
>
ahungry01:12:25

If I would like to make an npm library via clojurescript (built into a single index.js let's say), what would be the best way to do it? The guide on clojurescript using deps.edn and no lein doesn't make it clear how to integrate emacs cider via piggyback and the cljsbuild lein template fails for me, it says it can't find files. Figwheel template seems more front end oriented

ahungry01:12:50

I am familiar with npm/node and clojure, just new to clojurescript

ahungry06:12:29

What's the best way, without heavy lib dependence, to have clojurescript (nodejs) halt until an atom is set? Is there a Thread/sleep equivalent? I'd hate to run in a loop with no pause until I find it was set

ahungry06:12:19

I have an async call to load a protocol buffer schema using protobufjs (https://github.com/ahungry/functional-riemann-client/blob/master/src/main/fnrc/core.cljs#L17) and I don't want to leave a timing issue in there hoping a user loads it before I try to reference it

thheller07:12:13

@m131 you can't block in JS in any way as there is only one thread. nothing else will be happening while you block so it would never unblock. need to go async for pretty much everything in node

orestis08:12:45

I want to use something to do sprintf/format like functionality. I’ve seen reports that goog.string/format has DCE issues, but I’m not sure if that’s resolved and what’s the current best way to deal with this.

todo10:12:43

@cfleming: is there a clojure / IntelliJ Open API function I can call that does the same as "close all OTHER buffers' ?

fbielejec15:12:22

are :closure-defines visible at macro expansion time?

dnolen16:12:29

@fbielejec yes, though you shouldn't act on them at compile (macro) time in a library unless you want to break global caching

dnolen16:12:39

in an app, less problematic

fbielejec16:12:14

actually now I found [this](https://clojurescript.org/news/2018-03-28-shared-aot-cache), which says:

The AOT cache logic cannot handle the case where shipping JARs employ macros that consult the ambient environment in order to affect the code generated for the source shipped in those JARs.
and then:
it is recommended that libraries and tooling employ goog.define instead, perhaps with the help of :closure-defines, as this makes JARs cache-friendly.

fbielejec16:12:00

but from what you're saying I could get old results (cached) js as a result?

kwladyka18:12:16

I think he wanted to say if app A use module X and you use in app B module X with different closure-defines for macro in module X, compiler will use cached A code with different closure-define for this macro, than you want in app B.

👍 4
kwladyka18:12:44

that is why we can’t use macros for environment settings, only clojure-defines.

fbielejec16:12:11

@dnolen gotcha, thank you

madstap16:12:23

Minimal repro of what @lilactown posted yesterday

dnolen16:12:53

@madstap and that doesn't apply to regular fns yes?

madstap16:12:12

foo.bar=> (defn bar [& args])
#'foo.bar/bar
foo.bar=> (apply bar (range 100))
nil

dnolen16:12:24

k, please open a JIRA ticket with this info if you have a chance https://dev.clojure.org/jira/browse/CLJS, and the contents can just be what you posted above and note that this specific to multimethods in the title

madstap16:12:44

something like "invalid arity exception when applying multimethod with rest args"?

dnolen16:12:25

mulitmethod apply with >20 args fails is fine

👍 4
dnolen16:12:39

and major priority is good for this one