This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-09-20
Channels
@dialelo: thanks.
added high resolution timing to ClojureScript https://github.com/clojure/clojurescript/commit/2fa41e7969d22f72876122d2250baf4ef936e6e9
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
@venantius: the error seems unrelated to Om or even possibly cljs-ajax
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 …
Ambly works fine when I start a repl from the command line.
Re: Clojurescript testing with boot this seemed to work quite nicely - https://github.com/boot-cljs-test/testem-runner
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).
What am I missing here?
Is the mult consuming them instead?
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
@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.
I see. I can’t do that as it would imply modifying re-frame.
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?
Ohhh… middlewares. Thanks @jaen, I’ll look into that 😄
No problem, there's some wiki on that topic that should help you. Re-frame's got a really good documentation.
Argh, you need to manually apply the middleware when registering the handler.
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.
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
@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
@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.
@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
@darwin: I have a very simple change that allows to tap into re-frame’s events, I’ll probably have the PR later today.
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)
@bbss: it seems you are trying to load sablono but you have not provided the dependency (likely in your project.clj)
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"]]
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.
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.@seantempesta: FWIW, I tried just now and can’t repro what you are seeing.
Huh. Okay. I’ll try reinstalling some things. Thanks for checking.
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?@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?
@fdserr that’s happening because the ns doesn’t exist for whatever you are trying to resolve
@bbss I'll look into this. The Devcards instructions make the happy path available. I haven't tested other setups.
this isn’t how macroexpand
works in Clojure of course, but macroexpand
doesn’t exist in that form in ClojureScript yet
@dnolen `cljs.user=> (int 5)
5` , and test above is against '(int 5)
aint'it /pondering
cljs.user=> (ana/macroexpand-1 {:locals {} :context :expr :ns 'cljs.user} `(int 5))
(cljs.core/int 5)
/merryhi 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
any idea how to solve this?
tail -f out/watch.log
does nothing (`watch.log` doesn’t exist)
@spinningarrow: look in the dev console of your browser to see if any errors pop up
@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
yeah, those errors show up in the console when loading http://localhost:3449/devcards.html
@jackjames: can you try running lein run -m clojure.main scripts/repl.clj
assuming that that is the name of your cursive REPL script
@jackjames: this is fascinating behavior I have no idea why devcards.html is getting served that way @cfleming?
@jackjames @bbss : rename devcards.html to something else like hello_devcards.html
@jackjames: that what I get for being naive about java dev practices, learning the hard way
what’s the correct syntax to require/import something from cljsjs? i still suck at the ns form
webpack at least recognizes this disaster & offers you tools to fix shit up: http://webpack.github.io/docs/shimming-modules.html
@bbloom: stuck with that until @jaen @maria and I can sort something out, progress is being made steadily.
i’ve had to use every single one of those webpack shimming techniques in a relatively simple project at work for different dependencies
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
at least the google closure model recognizes exported names as a first-class idea, rather than piggie-backing on objects
the ES6 import/export syntax is absurdly confusing & i’m not sure what the benefit of it is at all
@bbloom: take a look at (older) https://github.com/jaen/custom-module-loaders and https://github.com/jaen/react-with-modular-cljs (newer)
basically all the js tooling has already figured out how to recognize assignment to module.exports or exports.foo
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?
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
But one wouldn't need to deal with de-require'ing as a separate step, but could lean on Cljs compiler
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
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.
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).
@bbloom: don't worry, I won't get triggered from people being frustrated about things, that's entirely normal when being a developer ;' )
I’ve got figwheel working in an existing project, and I love it!
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
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.
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.
@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?
@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
i’d appreciate it if lein clean
disappeared… clean builds is an idea from an imperative world that has no place in clojure land
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.
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)
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
@dnolen: the this-as macro is kinda clunky… any chance we could get (defmacro this [] (list 'js* "this”))
added to core?
@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
@bhauman: I haven’t actually tried yet. Have to decide the best way to port phantom JS tests to something that would work with figwheel.
@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
@jackjames: @bbss deployed fixes for the resource problem you found in devcards. It should work fine now.
using (devcards.core/start-devcard-ui!)
make the page look like the devcards page. but there is no content.
@benzen: is the code public somewhere?
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.
@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
thanks @martinklepsch
oh it’s just calling the namespace directly, but not main like it used to in chestnut, hmm
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?
@benzen: looks fun to me but I also don’t know anything about devcards. Can you put the whole project on github?
by “these kind”, you're implying that it’s redundant, so it doesn’t matter if it’s any better? or something else?
@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
@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
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
@benzen: yeah the instructions for setting up devcards without figwheel haven't been written yet
But yeah you need to have :devcards true
in the build-options for the cards to get rendered
@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
.
@vorob checkout #C05006WDW and #C06B40HMY
@danielcompton: thnx bro