Fork me on GitHub

I have written a little bit of clojure but have almost no experience with clojurescript. I want to learn cljs by writing an admin tool for work. I’m finding the options to start out a little overwhelming: om,, re-frame, hoplon, … Can I can some pointers on where to start? The app is a relatively simple admin tool (superseding a rails/underscore.js app), mostly searching for users and examining their data streams. There might be some minimal visualization in the future.


@dangit: I found re-frame to be a pretty easy entry point, but I think hoplon would be a great option as well- both have active and helpful channels on here. Rum with datascript would be a good choice as well, particularly if you are comfortable with Datomic. Om next might be a bit too much to learn at the start, but there are a quite a few people using and loving it.


@dangit may I suggest reagent? It will work well if you’re not building an SPA and doesn’t contain a lot of the complexity that exist in om


i rethink reagent has the shallowest learning curve if you’re already familiar with react


re-frame adds a lot of stuff of arguable value on top of reagent


but inarguable: it’s more stuff to learn


@dangit My vote would be for Rum: Very simple API on top of React.


You could take a look at tourney-bot as a reference. Real-world application written in Rum:


@bbloom re-frame tries to deliver architecture for medium sized apps and up. Sure, if you have a small, simple app you don't have much need for architecture. Any of the "V" generation libraries will be good to use: Reagent, OM, Rum or Quiescent. But there is a reason why Redux, cyclejs, the Elm Architecture, Pux, etc exist. As your app gets beyond trivial, you need architecture. I've been embedded daily in the Reagent world for 3 years now, and I relentlessly hear the following: "I started off with Reagent, which I love, but after 6 months I had created a bit of a mess". Every single time, what that person is actually saying is: "I started in Reagent without any sense of an Architecture and I grew one in an adhoc manner which ultimately wasn't pleasing". You can't not have an architecture as the app gets bigger - the only question is which one. Reagent (and the other V libraries) don't give you archecture. But, one way or another, you are going to be growing one. So please be careful about telling people that archecture is "a lot of stuff of arguable value". I've REPEATEDLY seen where that goes. If instead you want to suggest an alternative archecture, then I'll happily discuss re-frame at the level of "why this archetecture is better than that, or not". But if your goal is to simply dismiss the need for any architecture, I'd say that's poor advice. I'll be seeing that person across in #reagent in 6 months asking for advice.


@mikethompson I said that it’s of arguable value because we can clearly have an argument about it 😛 I’m not trying to shit on your work. My apologies if it seems that way. Overall, I feel re-frame has its head screwed on straight and wouldn’t argue vehemently against it other than in terms of ramp up time.


That said, I firmly believe that most of what re-frame provides is general in a way that isn’t useful for many applications; and that most of the benefits of re-frame can be accomplished via education rather than framework.


For what it’s worth, I’ve seen the exact opposite problem than the one you describe:


“Hey, we have 400 Relay Stores"


"umm… what?"


One last thought: I did read through the re-frame docs and various wiki-materials. Overall, it’s quite well written and the docs may be even more valuable than the code 😉


s/relay/whatever they called that thing before relay/


The docs took 10 times more work than the code :-)


probably the correct balance 😉


Don't worry about the shitting on the work thing .. each time that happens I generally learn something. So I'm always up for that.


I'm older and robust. But cantankerous.


for me, it’s about leverage - if i have to invest a bunch of time caring and feeding for a framework, i better be getting a lot of leverage. that means the product of value and occurrences of getting that value needs to be large


flux was very early, redux dominates these days


In that case you should be using re-frame :-)


for most apps i’ve worked on, even decently large ones, i’d be able to count the number of stores, effects, co-effects, whatever, on one hand


and each is slightly different


A lot of apps are dominatred by a remote data store


usually 5-20 lines of straighforward machinery satisfies my needs


But, and this is my main point, one way or another you are creating an archecture.


sure, and i am well versed in the design of such architectures


and so having someone design one for me is of lesser value than it may be for other folks


If your claim is that you like your architecture more and that re-frame is too much overhead, I understand. But be careful in your advice to others on this point. They may not grow the same architecture you do.


no, i’m making two independent claims


I end up seeing those people in the #reagent channel in 6 months from now


1) education is more valuable than code with respect to architecture


and 2) new folks should start on top of a smaller foundation


i’ll add one more claim


3) I believe #2 to be true, even if they are 100% guaranteed to show up in reagent in 6 months asking for help and/or moving to re-frame


the journey is important part of #1


Ha! Indeed, The ones who have suffered first tend to appreciate re-frame more, yes. They tend to be the most effusive in their praise. Which is always nice for an OSS person to hear.


Anyway, i think we are broadly in agreement


not making a judgement about re-frame specifically, but many libraries should be blog posts … for example:


grumble grumble let’s add an intermediate dependency!


Hi, I’m trying to eval cljs code in cljs code, is there any way to get current compiler state (I need compiler state with current namespaces set), other than creating it with empty-state and manipulating it directly?


In general, pick a tool that solves the problems you currently have. If you're growing new problems from prior choices, and a new tool helps tackle those problems, migrate to / use the new tool. Pragmatism at its finest, and removes a lot of the issues that come from trying to get it right the first time, with some cost down the road for migration.


Hi, we’re seeing the warning "WARNING: :preloads should only be specified with :none optimizations” because we’re trying to use :preloads with :simple optimizations. Why is :preloads incompatible with optimizations?


The use case is that we have a test build. In the test build, we want to call (enable-console-print!) as early as possible. We also were thinking that running tests at the same optimization level as our prod build might detect bugs related to optimization.


do you have a call to run-tests? presuambly you can just add the code you want right before that


We do, but we call it in a function that happens after all the code loads. The place we’re getting into trouble is that we print out some test information as the namespace is loading (regarding the value of some test configuration variables).


Sometimes that print works, because it happens to be the case that (enable-console-print!) was called previously in another file. But if we say, rename a file, then the load order can possibly change, and suddenly println will error


maybe the better fix is to never call println during loading of namespaces - we could wrap that in a function and call that before run-tests


you can put the enable-console-print! in a test-init ns or whatever and require that first


but yeah, generally, you should avoid effects on ns load


it is a bit easier to remember “don’t call print on ns load” than “its ok to call print on ns load, but call enable-console-print right before!” 🙂


no, that’s not what i’m saying


i’m saying that you have two entry points: 1 for your app and another for tests


just make sure all your tests go through a common entry point


and you can put the enable-console-print! in there


requires are processed in order


OK, maybe I need to back up one step then. How do I know which files will load first? If I have a.cljs and b.cljs in a test directory, and one calls enable-console-print at ns load, and the other calls println .... I’m not sure how to guarantee any order without a preload


how are you running your tests?


via ios with react native


so we register a handler that in turn calls run-tests


at some later time, but after all ns are loaded


hm, um, ok i’m not quite sure if that has any implications on this advice, but here goes:


sure, it adds another fun layer of complexity 🙂


2) note specifically "it's idiomatic to create a test runner namespace "


3) configure your test build configuration’s main ns to be that test runner namespace


> main ns to be that test runner namespace Do you mean by using the :main option? that was one thought I had, but it seems also to only work with :none.


(checking out that link, thanks for that!)


if you can’t use :main, you can still just use goog.require from the outside or whatever you’re doing to call your entry point now


Oh, that’s a good idea, yeah


OK, I’ll give that a go. Thanks a ton for your help and patience!


Hi! does anybody here use and if so, might I pick your brain some?


@sova you’re more likely to get an answer if you just ask your question


people are unlikely to agree to help before they know whether or not they can help at all 🙂


the docs for re-frame talk about waiting until early 2016 before it'll be supported on most browsers


it's nearly 2017 and those docs don't appear updated. wonder what the status is


thanks. is flexbox the only blocker?


From the docs for re-com: > the entire layout side of this library plus a few of the widgets rely on Flexbox which only works on modern browsers, and specifically not IE 9 and 10.


and not 11 either, it seems


You will need to make your own assessment. We have the luxury of knowing our browser target


@kenrestivo even bootstrap is heading towards flexbox these days so it must be getting mainstream But, like I said, each to their own. For exaple, flexbox used to work slowly on firefox, but then it got fixed.


not a problem, but some projects are based on re-com so i'm trying to decide if i can follow them down that primrose path


@kenrestivo You got me curious. So I'm currently running the re-com demo program which obviously uses flexbox extensively on IE11 without any apparent problems. Everything works and performaance is fine. So the caniuse warnings about bugs may themselves be out of date.


No wait, I do see a couple of problems with popovers


I'm trying to evaluate cljs on a nREPL from javascript by sending an "eval" message. It evaluates clj just fine. I'm starting an nREPL from lein, and using piggieback to start the cljs-repl (cemerick.piggieback/cljs-repl (cljs.repl.rhino/repl-env)). I have also added the wrap-cljs-repl middleware, so the repl itself in terminal is working. Its just when I send a msg to the nREPL that it fails to evaluate cljs, it seems to compile the sent expression as a temp .clj file. and complains on the js namespace "CompilerException No such namespace: js" Anyone have any idea as to why this is failing ? Do I have to communicate that I want it to evaluate as cljs somehow?


so my understanding so far with is that IQuery pretty much makes my data-needs look like Datomic Pull syntax... There is a read-fn and a mutate-fn ... do I need to make many of these ? only if I want to mess with the atom that is my application-state, right?


Hi, I am trying to use ReactCSSTransitionGroup in my project following the guide of . However, I am using reagent v0.6.0 instead of v0.5.1 , so I changed project dependencies to [reagent "0.6.0" :exclusions [cljsjs/react]] [cljsjs/react-with-addons "15.4.0-0"] . But it shows Uncaught Error: js/ReactDOM is missing. How can I fix this problem? Thanks!


@cmal you are probably missing the react-dom package


no idea how that is bundle with react-with-addons though or if it is


try adding [cljsjs/react-dom "15.4.0-0"]


OK. I'll have a try.


you might also need a (:require [cljsjs.react.dom]) if you require cljsjs.react somewhere


@cmal before you go too far down that path, consider this blog post:


We used to use ReactCSSTransitionGroup but switched to react-flip-move (recently) and loving it


Mike, thanks for the two working demos.


Hi all, I see some advice on Stack Overflow here that one should use (try ... (catch :default e ...)) in order to catch any error in ClojureScript. Does anyone have an official-ish reference for this?


(Planning to add a note on ClojureDocs, but I want to confirm first)


@timgilbert can confirm that it is official-ish, don't know if written down anywhere though


not totally offical since clojure doesn't support it yet


Ok, yeah. I didn't see anything obvious in a superficial skim over the cljs source either


Aha! Awesome, thanks, that's close enough


that issue links most of the background story


Yeah, I see it in there. Exactly what I was looking for.


@yogthos have time for a quick question Dmitri?


Is there a way to run some JS at compile time? e.g. I have some parsing I want done statically but the parsing library is written in JS.


@kenny you might be able to hack something together to do it, but I'd look at a clojure parsing solution instead. Unless you're replacing a specific binary parser, Instaparse will probably get what you want done


Unfortunately, it's far too much work to re-write the parser in Clojure.


mmm, shell out to node in a clojure macro then?


Something like that could work. I am looking into using nashorn. For some reason I can't find the lib on maven though..


nashorn is part of the Java 8 distribution I believe, not separate.


Ah, that's easy then!