Fork me on GitHub
#clojurescript
<
2017-03-20
>
dpurrington00:03:35

I had an issue with goog not being defined when using :optimizations none, but not with it turned on. I sure would like to be able to turn off opts b/c it is noticeably slower to rebuild.

thheller08:03:04

@mattsfrey if you put the jsloader into your :require it is guaranteed to be there

thheller08:03:27

if it is not in there you are relying on someone else having required it (ie. figwheel), so it may be lost if figwheel is no longer required (ie. optimizes builds)

thheller08:03:13

@dpurrington I think CLJS still requires that you manually include goog/base.js for :none unless you are using :main

dpurrington12:03:11

I've not manually included something before. Where would I do that? Does that happen in my project file?

dpurrington14:03:51

ah. I'm in a nodejs context.

dpurrington14:03:10

So I get the error on build.

hit02309:03:53

CLJS-newcomer doubt- What does the :source-map keyword do in CLJS ?

mccraigmccraig09:03:17

dyu mean as a cljs ompiler option @hit023 ? if so, it enables source-map generation - https://github.com/clojure/clojurescript/wiki/Compiler-Options#source-map

hit02309:03:01

Yes, as a compiler option (in boot's task: cljs).

raffy201010:03:19

hi guys, have a question about the function js->clj, I have read the source of that why does it just support transform plain js object?

raffy201010:03:41

(identical? (type x) js/Object)

raffy201010:03:30

Or how can I transform all js object, File, Date, Regexp to cljs data structure?

mattsfrey12:03:58

@thheller it's in the require, but is showing up undefined when built with optimizations: advanced

mattsfrey13:03:07

optimizations: none, simple it works fine

anthonylebrun14:03:29

Hey everyone, I’m new to Clojure/ClojureScript so I’m sorry if this glaringly obvious. I can’t seem to figure out this seemingly trivial issue:

anthonylebrun14:03:04

The console output for this is:

anthonylebrun14:03:56

This is a re-frame subscription, but I don’t think my issue is re-frame specific. I’m expecting find-sequence to return the correct sequence record based on the id argument, but I keep on getting nil.

danielneal14:03:30

It could be that your seq-id is a string, and the ids in the sequences might be numbers

anthonylebrun14:03:57

You know, I bet that’s it

anthonylebrun14:03:28

@danieleneal That was it! I’m using https://github.com/gf3/secretary for routing and it didn’t occur to me that all params would be strings.

anthonylebrun14:03:38

Doesn’t help that println doesn’t quote strings without spaces 😛

danielneal14:03:17

ha! yeah! This might be useful

danielneal14:03:57

I just came across it - I've always been a bit haphazard over whether I use println or prn for debugging statements

danielneal14:03:39

(prn) produces things that can be read back in so (prn "2") => "2" where (println "2") => 2

anthonylebrun14:03:09

Ah nice, thanks for that tip

anthonylebrun14:03:03

Or does it? This is weird: context = {:id "2"} seq-id = 2

gklijs14:03:50

What if you do (doseq [sequence sequences] (println (type (:sq sequence))) )

gklijs14:03:16

made some typos..

anthonylebrun15:03:44

@gklijs It’s all good now, @danieleneal pointed the issue (see above)

samueldev16:03:33

I need to perform n ajax requests simultaneously and then 1 subsequent ajax request when all of the prior n have completed

samueldev16:03:43

in javascript I'd use something like; promise.all

samueldev16:03:57

trying to figure out the best way to do it in cljs using only cljs (and core/async probably?)

anmonteiro17:03:42

@samueldev so core.async would also be my go-to for what you’re trying to do. Do N requests, put all their responses in a core.async channel, perform the last request when you’ve consumed everything from the channel

anmonteiro17:03:17

(and when there aren’t any in-flight requests)

pupeno17:03:46

Should a ClojureScript library use cljsbuild?

pupeno17:03:29

I have a library that defines (ns clientcommon.conf) and when I try to use it on another app (after installing it locally with lein install), I get this error: Caused by: clojure.lang.ExceptionInfo: No such namespace: clientcommon.conf, could not locate clientcommon/conf.cljs, clientcommon/conf.cljc, or Closure namespace "clientcommon.conf" in file C:\Users\pupeno\Documents\Dashman\configurator\src\app\configurator\sites.cljs {:tag :cljs/analysis-error}

pupeno17:03:06

Any ideas why?

johanatan17:03:30

@samueldev is promesa off the table?

samueldev17:03:00

@johanatan I had never heard of it until now, doing a quick search 🙂

samueldev17:03:20

Ah, a straight-up wrapper around bluebird

johanatan17:03:32

@samueldev it's the way i'd go. nicer abstractions than core.async

johanatan17:03:50

[it also uses core.async under the hood i think]

johanatan17:03:32

it's more than a wrapper too. see alet/`await`

thheller17:03:07

@pupeno did you check the contents of the generated .jar for your lib? if the file isn't in there in the correct path it won't be found

pupeno17:03:58

@thheller yes, I did, and the files were there but there was a stupidly embarrassing typo. 😳

qqq17:03:54

what's the most advanced instarepl at the moment, is it protorepl ?

ericnormand17:03:14

I'd love to ask this channel a favor

ericnormand17:03:41

I'm doing research for a re-frame course (I teach Clojure and ClojureScript at http://PurelyFunctional.tv)

ericnormand17:03:19

Please fill out this survey about re-frame. It will take 2 minutes: https://purelyfunctional.tv/re-frame-survey/

ericnormand17:03:41

it will help me make sure the course addresses your needs

qqq17:03:28

and apparently price it optimally to maximize profits 🙂

johanatan19:03:46

@qqq lumo and planck are nice

johanatan19:03:14

@qqq had never heard of proto-repl but i don't use Atom

noisesmith19:03:25

planck is more usable out-of-the-box (thanks to a custom api that tries to be similar to jvm clojure for files and shell), lumo is easier to get things done with (thanks to using node stdlib, and npm installed deps)

sankara19:03:46

I'm trying to use clojure.data.xml with a cljs/nodejs project. I'm kinda stuck getting emit-str to work (the doc says it should on cljs). This is the error I'm getting. Does anyone know how to fix/workaround this?

org.mozilla.javascript.EcmaError: ReferenceError: "XMLSerializer" is not defined. (rhino.clj#41)

qqq19:03:33

@johanatan , @noisesmith : Am I using the right term? I thought "insta repl" means an editor where you type clj code and it's evalauted as you type; whereas it seems like to me, insta repl -= instantly starting repl.

johanatan19:03:27

@noisesmith @qqq also, lumo starts up more quickly. planck is more mature however (as you mentioned)

johanatan19:03:46

@qqq not sure if there is any std use of the term "insta". they're just REPLs to me

sankara19:03:31

@qqq You are probably looking for "interactive programming" - I'm not sure what the standard terms are either. Here's what I use (CIDER - https://cider.readthedocs.io/en/latest/interactive_programming/)

johanatan19:03:33

@sankara CIDER is nice but i've found it's less reliable in CLJS land than plain CLJ. hence, i most often just copy paste from an editor into a CMD SHELL-based REPL

johanatan19:03:10

[also, my webapp itself uses figwheel which pops open a REPL automatically; once again somewhat detached from the editor]

noisesmith19:03:11

another option that is sometimes more elegant than copy/paste is load-file

qqq19:03:17

I'm looking for osmething like: http://oakes.github.io/paren-soup/ -- but a bit more mature

qqq19:03:29

note that in that example, as you type in the RHS, the LHS auto updates

qqq19:03:54

for example, in the 0 1 2 3 4 part, add a "5 6 7", don't even bother to hit enter, and see what happens

johanatan19:03:49

@qqq that looks like more of a "literate programming" tool somewhat along the lines of iPython notebook

noisesmith19:03:19

@qqq I know this isn’t a popular opinion, but I’d rather not use such tooling at all rather than deal with buggy tooling that sends me on wild goose chases for bugs, and I have yet to try anything of that type that doesn’t break on me in weird ways.

johanatan19:03:21

@qqq not sure if there are any std solutions for that in CLJ/CLJS land (probably several competing ones w/ no clear winner)

johanatan19:03:27

Jupyter claims to support Clojure notebooks: https://jupyter.org/