Fork me on GitHub
#clojurescript
<
2015-09-20
>
pupeno00:09:20

@dialelo: thanks.

venantius02:09:06

Does anybody have any experience using cljs-ajax with Om? I’m getting an Uncaught RangeError: Maximum Call Stack Exceeded error when I include what seems to be a pretty basic GET request inside an Om component

venantius02:09:54

come to think of it, I may be approaching this pattern the wrong way

dnolen03:09:58

@venantius: the error seems unrelated to Om or even possibly cljs-ajax

venantius03:09:53

@dnolen: that turned out to be correct 😉

seantempesta04:09:35

I feel like I’m probably missing something obvious, so hopefully someone else has run into this. I’m using @mfikes ambly with Cursive and have followed his guide to using a Cursive repl (https://github.com/omcljs/ambly/wiki/REPL-in-Cursive), but the repl just hangs and never connects to the iOS simulator. Has anyone experienced this? I asked in #C0744GXCJ and someone recommended I ask over here.

Starting clojure.main REPL...
Clojure 1.7.0
user=> (require
  '[cljs.repl :as repl]
  '[ambly.core :as ambly])
nil
user=> (repl/repl (ambly/repl-env))

Searching for devices …

seantempesta04:09:15

Ambly works fine when I start a repl from the command line.

jaen07:09:58

Re: Clojurescript testing with boot this seemed to work quite nicely - https://github.com/boot-cljs-test/testem-runner

pupeno08:09:32

I want to get a copy of the events re-frame is seeing, so I did this (mult re-frame.router/event-chan), but as soon as I do that, events seems to get lost (I have the event handlers print something, and when that line is present I can see that my handlers are not being executed).

pupeno08:09:39

What am I missing here?

pupeno08:09:16

Is the mult consuming them instead?

jaen08:09:19

That's probably obvious so you're doing that, but after you create a mult you have to create tap channels from it - https://clojure.github.io/core.async/#clojure.core.async/mult

jaen08:09:32

If that's not it then not sure what's the problem unfortunately

pupeno08:09:16

@jaen: yeah, I can tap on it and see the event on the tapping channel, my problem is that the original event is not being received by the go-loop re-frame uses to process them.

jaen08:09:37

Yeah, but as far as I understand if you create a mult everything should tap from it

jaen08:09:55

If something else consumes from not-a-tap the mult will never see it

pupeno08:09:00

I see. I can’t do that as it would imply modifying re-frame.

jaen08:09:01

At least that's how I understand it

jaen08:09:56

I never used re-frame directly (just followed the pattern in my own code), but maybe adding a middleware that would put events on the channel you want would help?

pupeno08:09:29

Ohhh… middlewares. Thanks @jaen, I’ll look into that 😄

jaen08:09:07

No problem, there's some wiki on that topic that should help you. Re-frame's got a really good documentation.

pupeno08:09:22

Argh, you need to manually apply the middleware when registering the handler.

pupeno08:09:20

Is there any way to get a copy of all values in channel when the channel is being used for both input and output? I think there isn’t, but since I’m new to core.async, I want to be sure before forking re-frame.

martinklepsch09:09:41

Theres some issue/PR in re-Frame removing the reagent dependency and generally decoupling a bunch of things. I think someone might be maintaining a fork with that PR merged

darwin10:09:20

@martinklepsch: that’s my PR, I’m going to sync it with later re-frame changes, so far I haven’t seen significant progress in re-frame’s master, so I haven’t done any updates

darwin10:09:18

anything particular in mind? dynamic subs?

darwin10:09:50

have to run now, will be back in 30mins

martinklepsch10:09:33

@darwin: I was referring to @pupeno’s problem above of not being able to mult/tap the channel before the go-loop listens to it.

martinklepsch10:09:22

@darwin: I think it would be cool to have some more “experimental friendly” fork of re-frame to incubate ideas etc. So keep it up simple_smile

pupeno10:09:30

@darwin: I have a very simple change that allows to tap into re-frame’s events, I’ll probably have the PR later today.

bbss11:09:36

I am trying to run devcards with cursive. But the approach here does not seem to work: https://github.com/bhauman/lein-figwheel/wiki/Running-figwheel-in-a-Cursive-Clojure-REPL It errors with

Exception in thread "main" clojure.lang.ExceptionInfo: No such namespace: sablono.core, could not locate sablono/core.cljs, sablono/core.cljc, or Closure namespace "sablono.core" {:tag :cljs/analysis-error}, compiling:(/Users/baruchberger/clojure/playground/script/repl.clj:3:1)

bbss11:09:47

Not sure how to proceed.

dnolen11:09:45

@bbss: it seems you are trying to load sablono but you have not provided the dependency (likely in your project.clj)

bbss11:09:48

Yeah I thought so too but it is. Running via lein figwheel does work.

:dependencies [[org.clojure/clojure "1.7.0"]
                 [org.clojure/clojurescript "1.7.122"]
                 [devcards "0.2.0-SNAPSHOT"]
                 [sablono "0.3.4"]
                 [org.omcljs/om "0.8.8"]
                 [reagent "0.5.0"]]

bbss11:09:25

Maybe it's some path issue. I will try to create a new project from scratch, because this intellij project has multiple projects in different dirs.

bbss12:09:50

Got closer this way, but now hitting something that seems like a bug:

GET  
devcards.html:6 
GET  404 (Not Found)
I'd expect the js and css to be:
<link href="/css/compcljs_style.css" rel="stylesheet" type="text/css">
    <script src="/js/compiled/compcljs_devcards.js" type="text/javascript"></script>
As those are in the resources dir, and I can't find anything that is named react-reload. The index.html/devcards.html with those project specific paths is not served either, so it's not some intermediate step.

mfikes12:09:18

@seantempesta: FWIW, I tried just now and can’t repro what you are seeing.

seantempesta12:09:35

Huh. Okay. I’ll try reinstalling some things. Thanks for checking.

fdserr12:09:04

Hi there. Anyone familiar with cljs.analyzer.macroexpand-1 please?

fdserr12:09:36

trying the answer at http://stackoverflow.com/questions/17491517/how-to-expand-macros-in-clojurescripts-cljs-core-namespace it seems a js/window object is needed but I'm on node:

cljs.user=> (require '[cljs.compiler :as comp])
nil
cljs.user=> (require '[cljs.core :as core])
nil
cljs.user=> (require '[cljs.analyzer :as ana])
nil
cljs.user=> (ana/macroexpand-1 {:locals {} :context :expr :ns 'cljs.user} '(int 5))
Error: window is not defined
    at new cljs$core$ExceptionInfo (/Users/fdeserres/prj/xforms/target/dev/cljs/core.cljs:9863:11)
    at Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3 (/Users/fdeserres/prj/xforms/target/dev/cljs/core.cljs:9896:5)
    at cljs$core$ex_info (/Users/fdeserres/prj/xforms/target/dev/cljs/core.cljs:9890:1)
    at Function.cljs.analyzer.error.cljs$core$IFn$_invoke$arity$3 (/Users/fdeserres/prj/xforms/target/dev/cljs/analyzer.cljc:535:5)
    at cljs$analyzer$error (/Users/fdeserres/prj/xforms/target/dev/cljs/analyzer.cljc:531:1)
    at cljs$analyzer$macroexpand_1 (/Users/fdeserres/prj/xforms/target/dev/cljs/analyzer.cljc:2362:11)
    at repl:1:55
    at repl:9:3
    at repl:14:4
    at Object.exports.runInThisContext (vm.js:74:17)
Any thoughts?

dnolen12:09:55

@fdserr: you need to (set! *target* “nodejs”), bug in REPL since fixed in master

fdserr12:09:04

@dnolen Excellent, cheers David ^^

fdserr13:09:17

@dnolen Dunno what to do with that one either: Error: Cannot read property 'findInternedVar' of null. Same test as above, on 1.7.58. Would upping to master help?

dnolen13:09:05

@fdserr that’s happening because the ns doesn’t exist for whatever you are trying to resolve

bhauman13:09:07

@bbss I'll look into this. The Devcards instructions make the happy path available. I haven't tested other setups.

dnolen13:09:34

@fdserr: in this case you’ve passed ’int

dnolen13:09:53

@fdserr: normally all symbols should be resolved before calling macroexpand

dnolen13:09:12

this isn’t how macroexpand works in Clojure of course, but macroexpand doesn’t exist in that form in ClojureScript yet

dnolen13:09:35

so try `(int 1)

fdserr13:09:59

@dnolen `cljs.user=> (int 5) 5` , and test above is against '(int 5) aint'it /pondering

fdserr13:09:38

backtick ^^ thanks

fdserr13:09:39

cljs.user=> (ana/macroexpand-1 {:locals {} :context :expr :ns 'cljs.user} `(int 5))
(cljs.core/int 5)
/merry

bbss13:09:42

@bhauman: Okay, let me know if I can assist.

bhauman16:09:41

@bbss: yeah can you get me a gist of your project.clj?

spinningarrow16:09:48

hi folks! I was trying to start learning clojurescript by following the instructions here: https://github.com/clojure/clojurescript/wiki/Quick-Start but I got stuck at the “Browser REPL” section. It just keeps saying “`Waiting for browser to connect…`” even though I opened localhost:9000 in my browser

spinningarrow16:09:43

any idea how to solve this?

spinningarrow16:09:02

tail -f out/watch.log does nothing (`watch.log` doesn’t exist)

bhauman16:09:24

@spinningarrow: look in the dev console of your browser to see if any errors pop up

jackjames17:09:56

@bhauman: i also skipped the instructions, went straight into attempting to adapt them to cursive, and hit the same "cljs_react_reload..." errors. project.clj: https://www.refheap.com/109775

bhauman17:09:20

are you loading devcards.html ?

bhauman17:09:28

@jackjames: ^

jackjames17:09:11

yeah, those errors show up in the console when loading http://localhost:3449/devcards.html

bhauman17:09:26

@jackjames: can you try running lein run -m clojure.main scripts/repl.clj assuming that that is the name of your cursive REPL script

jackjames17:09:32

@bhauman: script/repl.clj in my env, but yeah, that works

jackjames17:09:54

(minor warning about react keys, but no cljs_react_reload errors)

bhauman17:09:51

@jackjames: this is fascinating behavior I have no idea why devcards.html is getting served that way @cfleming?

bhauman17:09:49

hmmmm I bet it is on a resource path

bhauman17:09:07

@jackjames @bbss : rename devcards.html to something else like hello_devcards.html

bhauman17:09:38

cljs-react reload has a devcards.html in the resources directory

jackjames17:09:17

@bhauman: yeah that solves it

bhauman17:09:21

@jackjames: that what I get for being naive about java dev practices, learning the hard way

bhauman17:09:19

on the bright side I finally got cursive up and running properly

bbloom19:09:09

what’s the correct syntax to require/import something from cljsjs? i still suck at the ns form

bbloom19:09:56

let’s just say react, since it’s popular

bbloom19:09:08

only thing i can get to work is (:require [cljsjs.react]) and then js/React

bbloom19:09:24

is that really how this works? loading the code for effect?

bhauman19:09:43

@bbloom: yep!

bbloom19:09:46

the js module story is a sorry mess

bbloom19:09:06

webpack at least recognizes this disaster & offers you tools to fix shit up: http://webpack.github.io/docs/shimming-modules.html

dnolen19:09:15

@bbloom: stuck with that until @jaen @maria and I can sort something out, progress is being made steadily.

dnolen19:09:25

there’s already working prototype stuff

bbloom19:09:33

@dnolen: really good to hear

bbloom19:09:52

although i am super glad that cljsjs exists — good community effort

bhauman19:09:01

And this is inherited from GC

bbloom19:09:07

i’ve had to use every single one of those webpack shimming techniques in a relatively simple project at work for different dependencies

bbloom19:09:15

it’s crazy - there’s no consistency in js libs

bhauman19:09:00

I really wish the rest of the JS conglomerate would look at the Google closure model. Jesus it's sane competed to what they are doing

bbloom19:09:24

the provide/require stuff?

bbloom19:09:32

i think the ES6 modules train has left the station

bbloom19:09:05

at least the google closure model recognizes exported names as a first-class idea, rather than piggie-backing on objects

bbloom19:09:25

which are already overloaded as hell

bhauman19:09:28

For sure but are semantics like an object literal or like a closure?

bbloom19:09:10

the ES6 import/export syntax is absurdly confusing & i’m not sure what the benefit of it is at all

bbloom19:09:34

basically all the js tooling has already figured out how to recognize assignment to module.exports or exports.foo

jaen19:09:36

It's still prototyp-ish

jaen19:09:53

But you can require whatever you want from React

bbloom19:09:10

having keywords like import/export make it easier to find those, but no solution is complete w/o also looking for ‘require’ or ‘exports’, so why have to ways to do EXACTLY THE SAME THING?

bbloom19:09:44

nevermind the goofy “default” thing

bbloom19:09:58

@jaen: looking

bbloom19:09:59

i’m not super excited about the idea of dealing with npm in cljs land, but i’d much rather than then have to deal w/ making maven replicas of everything

bbloom19:09:13

so +1 keep up the good work

bbloom19:09:32

s/than then/that than/

jaen19:09:36

Well, if that's polished and lands in Clojurescript compiler

jaen19:09:46

Then some boot task can be made to deal/w npm for you

jaen19:09:49

At least that's the idea

bbloom19:09:26

i’d rather deal with it directly than another level of indirection

jaen19:09:27

So you could do (from-npm [["react" "0.13"]]) and it would take care of the rest

jaen19:09:43

Though I imagine libraries might still need some Clojurescript wrapping

jaen19:09:24

But one wouldn't need to deal with de-require'ing as a separate step, but could lean on Cljs compiler

bhauman19:09:57

@jaen: this sounds awesome! thanks for working on this. Tea

jaen19:09:42

Is tea good? ; d

bbloom19:09:09

yeah, please forgive my my tone - i’m just having a frustrating day: only get so much time to tinker lately & i seem to spend most of it dicking around with dependencies & such. no fun

bbloom19:09:26

definitely thank you for working on this

jaen19:09:21

Though if you're asking about if it's good for using then not quite yet, I mean both projects work, the first one even has some more fancy libraries like material-ui working, but it's all one big hack.

jaen19:09:54

In the newer one you could probably make a reagent app and be happy with it, but more complex dependencies won't work yet (it doesn't know about things like main file yet for example).

jaen19:09:37

@bbloom: don't worry, I won't get triggered from people being frustrated about things, that's entirely normal when being a developer ;' )

jmckitrick19:09:36

I’ve got figwheel working in an existing project, and I love it!

bbloom19:09:39

it’s cool, i’ll just never take a dependency ever again 😛

jmckitrick19:09:25

Next, I’d like to know if there’s a blog post, tutorial, etc about how to set up a test runner for figwheel, like the one @bhauman had with the red/green favicon

jaen19:09:42

I don't think that's a test runner

jaen19:09:46

That's devcards I think.

jmckitrick19:09:35

I’ve looked at his crash verse code, and it’s a start, but since my current cljs test runner is to verify that the Reagent DOM reflects what it should when data is pushed into state, I’m not sure the crash verse test runner is along the same lines.

jaen19:09:01

Anyway, give this a few weeks before this whole modules things is usable - a) I need to finish the Clojurescript compiler integration, b) talk it over with Maria if the current approach makes sense (might not, because it's based on the code she did for foreign libs and they're done one-at-a-time, so there might be something more sensible to be done if we deal with whole libraries), c) code it clean this time, d) it will probably require a patch for GClosure to let us provide an alternative implementation for ES6Loader so it would have to trickle upstream there.

jaen19:09:14

But when it's done I anticipate it will be helpful with React Native and all

bbloom19:09:25

@bhauman / @dnolen why do i need to do a clean build if i delete a .cljs file where a name may conflict with a previous state?

bhauman19:09:17

@jmckitrick: glad you like it :) I'm not sure why your tests wouldn't work. It's a JS env right? There is just a trigger to have tests run after code has been hot loaded

bhauman19:09:36

@bbloom: yep

bbloom19:09:17

i’d appreciate it if lein clean disappeared… clean builds is an idea from an imperative world that has no place in clojure land

bbloom19:09:38

but before i can disappear, i have to not need it with such frequency

jaen19:09:32

I use boot and I'm pretty happy with it. I remember that quite a bit ago I tried to properly setup clsj, figwheel and whatnot and it was a pain to get all those piggiebacks and weasels in order. Not sure what situation is now in lein-land.

bhauman19:09:49

Well we would have to check for deletions a propagate them to the output dir.

bbloom19:09:46

i haven’t switched to boot yet b/c (at least last i looked) it seemed like yet another new thing & popularity is my primary requirement for build/etc tools…. so that i can ask for help b/c i don’t want to spend any more cycles thinking about it than i have to (which is already a lot)

bhauman19:09:05

@jaen: weasel is really not needed

bhauman19:09:26

I tried porting figwheel to boot. I didn't work too much file system magic. You can't write scripts that depend on the file system... Kind of a problem

bbloom20:09:44

@dnolen: the this-as macro is kinda clunky… any chance we could get (defmacro this [] (list 'js* "this”)) added to core?

bbloom20:09:26

minus the damn slack smart quotes

jaen20:09:57

@bhauman: ok, kinda true about the filesystem magic; stock clojurescript clsj.clousre/lib-rel-path looks like this - https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj#L1208-L1217 - I had to patch it to look like this - https://gist.github.com/jaen/59dfcc53b1db0582f448

jaen20:09:15

In other news what the hell happened it's not in the repo o_0

bhauman20:09:55

@jaen: yeah thats enough to keep me away

jmckitrick20:09:50

@bhauman: I haven’t actually tried yet. simple_smile Have to decide the best way to port phantom JS tests to something that would work with figwheel.

bhauman20:09:08

@jmckitrick: yeah I'd just use figwheel for a little while first to get a handle on it, and it sounds like you'd want your tests to run in the browser and in a headless env like phantom as well

bhauman20:09:53

@jackjames: @bbss deployed fixes for the resource problem you found in devcards. It should work fine now.

benzen20:09:23

Hi ! I'm having a hard time setting up devcards. I'm using boot-reload.

benzen20:09:55

using (devcards.core/start-devcard-ui!) make the page look like the devcards page. but there is no content.

benzen20:09:10

At the moment i have only the simplest card possible

benzen20:09:16

`(defcard string-card (str "## *string* type will render as markdown.")) `

benzen20:09:32

When i look at my compiled name space. the lines that content my card disappears

benzen20:09:19

Any advice, or possible step to get any helping error message?

martinklepsch20:09:02

@benzen: is the code public somewhere?

benzen20:09:36

Here is my build.boot

blissdev20:09:52

Using figwheel, it seem like I got everything setup correctly, figwheel loads but doesn’t seem to call my main function, but there are no errors. Any ideas as to what I might be doing wrong? The :main under :compiler seems correct.

martinklepsch20:09:34

@benzen: :unified isn’t a thing anymore but other than that looks fine. I’d focus on why the compiled js doesn’t look as you’d expect

benzen20:09:31

thanks @martinklepsch

benzen20:09:38

and here is my devcards namespace

blissdev20:09:29

oh it’s just calling the namespace directly, but not main like it used to in chestnut, hmm

pupeno20:09:09

With cljx.ajax, would there be a way to check if there’s a pending AJAX request, that is, the request was sent and we are waiting for the reply from the server to call the callbacks?

blissdev20:09:49

please ignore previous messages, figured it out, just had to call main manually

martinklepsch21:09:37

@benzen: looks fun to me but I also don’t know anything about devcards. Can you put the whole project on github?

dnolen22:09:54

@bloom nope

bbloom22:09:14

@dnolen: why not? what’s wrong with it? (just so i understand)

dnolen22:09:28

Just generally not interested in these kind of language "enhancements" anymore.

bbloom22:09:11

by “these kind”, you're implying that it’s redundant, so it doesn’t matter if it’s any better? or something else?

dnolen22:09:31

It's just not an important or interesting enhancement.

bbloom22:09:48

i agree it’s not particularly important, but i definitely think it’s interesting 😛

darwin22:09:11

@dnolen: would be great if one could add her own namespace into the list of implicit namespaces, people could put utils and stuff they miss in core there

bbloom22:09:22

@darwin that’s definitely not going to happen

bbloom22:09:39

@darwin: once you do that, you’re writing your own new/private language

bbloom22:09:53

@dnolen: but point taken, i’ll shut up 😛

benzen22:09:40

@matinklepch so as explained on the documentation of devcards we need to specify an option in the compilation job in order to get things going

benzen22:09:52

bhauman maybe we could add a note on the doc of devcards about using devcards without figwheel or whit boot. Just to help people understand that the :devcards true options is required and is a compilation flag for devcards not related to figwheel

bhauman22:09:31

@benzen: yeah the instructions for setting up devcards without figwheel haven't been written yet

bhauman22:09:36

But yeah you need to have :devcards true in the build-options for the cards to get rendered

bhauman22:09:49

And you need to start the ui

bhauman22:09:29

and you need to require devcards core

bhauman22:09:52

@benzen: adding the docs to the README right now

jaen22:09:22

@dnolen: since you're here, does this change make sense from your POV - https://gist.github.com/jaen/59dfcc53b1db0582f448? Had to do it since Maria's code for module conversion currently outputs conversion results into the output-dir and this broke with boot where output directory is not relative to the build root. It might make sense to avoid writing out to the filesystem completely (maybe by assoc'ing :source to the ijs map or something else) until source-on-disk is called, but other than that I'm interested to know if relativising the path like that makes sense given module files need to be output to get consed onto :libs.

vorob23:09:44

Is it possible to find a job on clojurescript?

danielcompton23:09:33

@vorob checkout #C05006WDW and #C06B40HMY

benzen23:09:07

@bhauman: great thanks for your excellent work

vorob23:09:40

@danielcompton: thnx bro