This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
I'm having trouble getting doo to test in chrome
has anyone gotten it working?
Nice meeting you too @martinklepsch ! Disappointed there's no Rubby channel here ;)
Hi, I am trying to use cljs for screeps (programmable game in the browser), I just cannot get it done. I am using advanced compilation and just try to export one simple function: https://github.com/sveri/screeps/blob/42366307b9101c3a01c8a1bca2ef416c650cd1bd/src/screeps/core.cljs and this is the compiled js: https://github.com/sveri/screeps/blob/42366307b9101c3a01c8a1bca2ef416c650cd1bd/js/screeps.js. My namespace is screeps.core and when I do a `require ('screeps.core'); from js side it cannot find the module. Is it even possible to load namespaces like this from js? Directly calling the function with screeps.core.startscreeps.start(); does not work either. Any ideas / suggestions?
Hmm, require
s won't work, GClosure modules are not CommonJS modules but screeps.core.start()
should work though.
jaen: it says: ReferenceError: screeps is not defined and I got the feeling that the export does not work properly, at least I cannot find a functioned named start in the compiled js
What I see in the compiled js is: function Ie(){return console.log("foooooooooo")}var Je=["screeps","core","start"], but I would expect a function named start with a namespaces defined.
How can I write this code in ClojureScript:
var server = app.listen(3000, function () {
console.log('Example app listening at ', server.address().address, server.address().port);
});
@pupeno: (def server (.listen app 3000 (fn [] (js/console.log …. (.-address (.address server)))))
something like that
oh, are you also asking about string interpolation?
martinklepsch: that requires having that as top level, so that app should also be defined as a top level, so they are both global variables, which I’d rather avoid.
No, not string interpolation, but about that function having access the the return of .listen.
don’t really understand the question yet...
I don’t want to def server.
I want it as a local variable.
That’s what I’m thinking too but it can’t be that easy 😛
jaen: no, at the time the function is defined, whatever let will set didn’t happen yet.
That little JS code depends on having variables 😞
I've foudn this - https://gist.github.com/michalmarczyk/3c6b34b8db36e64b85c0
"No letrec, labels or flet - use (fn name [args]...) for self-reference, letfn for mutual reference.” http://clojure.org/lisps
There’s a letfn but it assumes you are defining functions.
TFW you wonder why project won't work and you misspeled clojars
to cojars` when deploying. Funny it did let it deploy then though.
Another chapter in trying to get those damn CommonJS modules workng is here. This time with boot and reagent - https://github.com/jaen/react-with-modular-cljs. Doesn't yet handle all conceivable npm libraries (no support for things like name
and main
yet) and you need to use mangled names, but hey - it's something!
@pupeno: don’t think you can do that with purely-lexical binding. You wouldn’t be able to do it with a let server = …
in ES6 either, as far as I can figure
I think in ClojureScript you’d need to use (set!)
Hi every one. I set up clojurescript dev environment from figwheel template. It works just fine out of the box. I tried to connect to my dev machine from outside from my android device. The problem is (fig-status) shows me that there is no client dev connections and consequently reloading doesn’t work.
I have been working on articulating the why of Devcards a bunch lately https://github.com/bhauman/devcards#why
I had seen devcards before, but didn't think of these advantages, very convincing. Going to give them a go in my recently started blog
@bhauman: probably when I'm building more sophisticated components. I see the history thingy: that's cool
@borkdude: after figwheel, I'm accustomed to folks saying "what's wrong with just reloading the browser?" Not that devcards is the same, but to me it is. Even the lowly todo item has a way more states than we normally give it credit for.
That is the thing that struck me the most in the why section, I have recently been thinking I should find a way to visualize whatever problem I am solving, whether it will be data that ends up looking pretty in the ui or not. And being able to save that problem solving process is super valuable documentation plus it can be used as a base for tests.
@bhauman: thinking about it, I could see it being useful testing how a component looks in different states and if the CSS is still good
@bhauman: because I have been working with a CSS designer and he could maybe use that too
@borkdude: yeah selenium tests, suck and they don't even tell us the very basics of whether an application is working.
Sweet!! Now it doesn't have to be devcards but a separate app that you can throw components into works as well. Devcards just gives shape to one way of doing this.
@tonsky: I was just looking at it - Looks solid, but it doesn’t meet my (admittedly nonsensical) requirements
just remember, when JS folks did js-native version of mori (immutable.js), turned out it was slower than cljs
any experience report info to share? from yourself or users? especially with respect to “time travel” and queries?
for most UI needs, i only really want/need pull-api & i don’t expect time travel to be valuable for my cache of server side data (which cant’ be time traveled from the client)
but 1) maybe i’m overlooking something and 2) I understand that (at least time travel) comes “for free” from immutable data structures
right, but can you do that on a whole-database level? what happens if you have two transactions occurring in parallel?
eg i click “X” next to two rows in a table to delete them, each sends a separate request, and then the first of the two fails
i’ve said it before: the dot operator is the best/worst thing OOP ever gave to the world
i’d like to say us clojure devs are enlightened, but then folks go and keyword-ize json objects in their server apps
speaking about experience reports: http://atomic.io uses js / immutable.js, but overall looks like a perfect fit for datascript
they have infinite undo/redo, persistent history, and queries over history (selective rewind over some group of objects)
you can do “big things” (like multi-step transactions) and decide not to apply them at the very end
but i think the pull API is more appropriate the entity or query for 9/10 UI use cases
I don't know how all these blog-posters convince their teams to use all the cool things they write about. I mean, how do you get that on the backlog?
most of it is “do whatever the fuck you want” inside “enlightened” overfunded tech companies
those of us who have woefully understaffed teams and real paying customers need to curb our enthusiasm, heh
The technical debt creation factory is quite efficiently micro-managed. No creating debt the old fashioned way, using whacky new stuff no one understands later on! ;)
Or, really, what an engineer hears is, "Ooo, I can score 'responsibility' points by putting fear into the manager with this 'immutable' fringe-science guy."
well in the JS world even if you capture a error margin of the market it still means tons of users
but i find those numbers suspect, b/c they suggest that virtually 100% of react users use it:
anyway - i think i’m going to create a project to spoon feed additional good ideas to the js community
back in the future…. @dnolen are you totally sold on the idea of sending pull-api queries to the server from the client?
obviously a good idea for server to send pull api data structure to the db, but from client->server it seems like you could share code w/ the server such that you only need to give the server the root get-query call
so instead of sending the server the expanded query, you give the server the top-level parameters, from which the server can re-create the query
especially since the query may be pretty large, given that every UI component has a tiny query fragment w/ it
Also, my first question when doing pull-queries client->server is how do you do access control? I’ve yet to see what people are doing for that.
tonsky: the version problem is a real one, but i’m not convinced a universal server is possible or desirable — or at least it’s not possible to avoid client-specific code, only to minimize it
versions is a much smaller problem for the web - modulo long-running single-page apps that you are going to upgrade constantly & force people to refresh or whatever … it’s a big problem for mobile tho
even without transit encoding I’m not really convinced the size of the query matters that much.
if a component triggers a mutation then the router and custom logic will trigger queries to be re-run
A library I’m using (re-frame) uses a go-loop. I have a function that puts something in the channel this go-loop is reading and I need to stop and let that go-loop run until the channel is empty. Is this possible?
borkdude: this might make it clearer: http://stackoverflow.com/questions/32672676/in-clojurescript-let-a-go-loop-run-until-its-channel-is-exausted
I need to force processing the channel until it’s exhausted before continuing doing other things in my function.
ok, so you want to wait until the channel is empty and then continue doing something else.
borkdude: yes.
which probably means manually processing the channel or something like that, as there’s no waiting in javascript.
Yeah, this channel is never closed 😞
Fewer externs seem to be needed than just a few months ago.
Has there been work on extern inference?
borkdude: I actually don’t know. Normally, nobody cares about that because on the browser you just render the app over time. But when pre-rendering on the server, at some point I need to finish it and ship it to the browser.
@pupeno: you could timeout on the <!
That's a reasonable definition of "empty" for a channel that never closes
@pupeno: so you basically need to pause your go-loop until something happens to unpause it?
ericnormand: there’s another signal that I have to take into consideration (whether a handler is being run), but that one is easy.
@jaen: no, I want a specific go-loop to run until it parks and then do something.
I don't think that's possible. The current state of a go block is not available.
The only way you could spy into it is if you could mult the channel before the go loop got it, like @borkdude was saying
Or something similar, of course
But frankly it sounds iffy.
Maybe an alternative approach could be to emit some sort of “done” event from the app and render after that happened
martinklepsch: it’s impossible to emit a done signal in this case.
Thinking a bit more about it, I think what I want to do is wait until the channel hasn’t seen any activity for n milliseconds or the app has been running for m milliseconds.
Is this documentation for both clojure and clojurescript or just clojure? http://clojure.github.io/core.async/
both, but cljs is limited to one thread, so anything that says "blocks thread" won't work
@estsauver: hey there! Thanks for the email!
pupeno: you can also check http://funcool.github.io/clojurescript-unraveled/#appendix-b-csp-and-core-async for a less terse documentation, we cover everything cose.async offers in ClojureScript with examples
@dnolen: is ClojureScript smarter about inferring externs than it was a few months ago?
@ericnormand: it’s never inferred externs … so no
bizarre
I specifically remember having to add an extern for something
and I upgraded clojurescript and now it's not required
it was screen.width
specifically
@ericnormand: depending on what it was an update of the closure compiler might have added an extern for the thing you added
could be
that sounds like a likely candidate
@ericnormand: thanks for writing this up https://twitter.com/planetclojure/status/645353183863181312
@dnolen: You're welcome!
going to Strange Loop?
personally being able to interactively test via cljs.test
+ a Node REPL is yet an other huge plus for me over JavaScript
oh, wait, you're speaking!
I totally agree
lispers like feedback
@ericnormand: did you run into any trouble while setting up doo
?
yeah, lots of trouble
but I don't know if any of it is doo's fault
I was having npm issues
because I rarely use it
it was probably 3 years old
and I didn't realize it
and there were some things I couldn't figure out with Boot
but I think i figured everything out on the Leiningen side
I think doo
is going to be great, though