This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-08
Channels
- # architecture (8)
- # beginners (78)
- # boot (20)
- # cider (81)
- # clara (53)
- # cljdoc (10)
- # cljsjs (3)
- # clojure (55)
- # clojure-boston (1)
- # clojure-dev (25)
- # clojure-nl (3)
- # clojure-uk (65)
- # clojurescript (65)
- # core-async (1)
- # cursive (41)
- # data-science (4)
- # datomic (16)
- # editors (74)
- # emacs (17)
- # events (1)
- # figwheel (3)
- # hyperfiddle (39)
- # immutant (16)
- # jobs-discuss (62)
- # juxt (2)
- # keechma (2)
- # leiningen (6)
- # mount (7)
- # nrepl (1)
- # off-topic (30)
- # onyx (14)
- # protorepl (2)
- # re-frame (4)
- # reagent (15)
- # reitit (19)
- # shadow-cljs (102)
- # sim-testing (1)
- # spacemacs (44)
- # specter (15)
- # tools-deps (50)
- # vim (2)
@takamura.developer I think it's fair to say that Om.Next is very opinionated compared to Reagent. Some people like an opinionated framework, some don't.
I did a project in om.next
and I confess it never gelled for me. I repeatedly had the experience of reading the documentation, having a false moment of realization, then sitting down to code and realizing I had no idea how to go about what I wanted to do.
What about tools? the usual tools for cljs development are: lein ou boots? figwheel or cljs-shadow?
@takamura.developer I can't give you much guidance on cljs tooling -- it's evolved a lot since I last tried to use it all (it was pretty bad three years ago! 🙂 ).
@takamura.developer You may wanna check out qlkit. It is a much simpler implementation of the concepts behind Om Next. About 300 lines of code. You can read the source to understand the concepts and then go about using Om Next. https://medium.com/@conrad_9565/lets-build-a-ui-with-qlkit-and-graph-queries-79b7b118ddac https://github.com/forward-blockchain/qlkit
ooh I'd not heard about qlkit
Where can I clear some caches if I keep getting an obviously wrong "Too many arguments to if" compile error? It only happens in one place under a cond->. It compiles if I remove the if, if I move the if out of the cond->, or in another function, or if I remove the cond->. CI seems to have passed on this code as well so it looks like a local issue.
Oh, you mean the first arg will be threaded into the condition part of the if!
@dpsutton Thanks for the hint. I was so convinced it was a local issue because CI seemed to have passed. I just noticed I pushed to the wrong branch tho :face_with_rolling_eyes:
I guess putting ifs into a cond-> is not such a good idea then.
I was trying to avoid having thing (fn) (not thing) (other-fn).
Not really. The threading that goes on before is actually relevant.
Sorry for being brusque above. I'm enqueueing some pedestal interceptors so I can't move the if before.
I meant I was trying to avoid exactly your cond-> example with the thing
and (not thing)
predicates as I felt it looks like "bad usage for cond->".
So I tried to be smart and use an if instead 🙂
Well, sometimes I am using cond->
with just one predicate to avoid repeating things so, maybe my radar is a bit off 🙂 [edited for clarity]
I believe I'm running into issues trying to use ClojureScript code as a callback within a JavaScript Library function. Is this a typical interop issue?
perhaps I should ping the #clojurescript channel on this one?
Hmm. I've not done enough ClojureScript to be sure. I know it's not an issue with Clojure/Java, because we're doing it, but we did have to reify
the thing we wanted to do so that Java saw it as a Java class with a method:
(reify Callback
(onCompletion [_ metadata exception]
(if exception
(log-message :error (produce-exception-log exception))
(log-message :debug (wrote-message-log metadata)))))
Is there something akin to reify
for ClojureScript/JavaScript?yes, there's a reify
macro in cljs
I've never used it though 😄
I'll give that a go
So that was where the Java lib was expecting a callback that implemented the interface Callback
(with some org.blah
stuff before, but we'd imported that), which required it to provide an onCompletion
function
Question: I was reading a StackOverflow question.
https://stackoverflow.com/questions/25439971/library-functions-vs-java-methods-in-clojure
And in the accepted answer the responder said
>Normally, I prefer to use wrapped Clojure functions, unless I have benchmarked and identified a performance problem, at which point I might drop down to direct Java interop.
I always thought that Clojure code becomes Bytecode and Java code also becomes Bytecode that the JVM then runs. If so then why would someone need to drop down to direct Java interop
if the both languages end up in essence as Bytecode?
Clojure is: 1. very dynamic 2. uses immutable data structures #1 means that sometimes the JVM is not able to optimize execution of the bytecode that Clojure is turned into because it can’t guess as easily what it’s trying to do. #2 means that, for certain operations, using a Clojure data structure will be much slower than using a raw typed Java HashMap or Array that you mutate
seems like they're referring to reflection, which i guess is easier to avoid with statically-typed syntax
I see what you are saying! @lilactown
Any specific reason why this fails with a `Class cast exception, trace missing: (map int (split (name :1-2) “-”))
(int "2")
ClassCastException java.lang.String cannot be cast to java.lang.Character clojure.lang.RT.intCast (RT.java:1213)
the #error{:cause nil, :via [{:type java.lang.ClassCastException, :message nil}], :trace []}
is not very … informative?
js/parseInt in javascript. Integer/parseInt is a static method in the Integer class definitely jvm specific
probably want the radix in it as well. Its easy to end up with a different base depending on input
CompilerException java.lang.RuntimeException: No such namespace: js, compiling:(null:0:0)
i don't know how cursive works then. did you try the Integer/parseInt? is it possible cursive thinks this is a clojure file not clojurescript?
What is the best/recommended way to start a new ClojureScript project? I saw the devcards template, but idk if there's a more common option.
Reading prior comments, reagent does look pretty nice.
Reagent is nice. So is Rum. In the project I am involved in we switched from Reagent to Rum because it was trickier to do server rendering of the views in the former. I think that might have changed.
Earlier today, some messages up in this channel I heard of Qlkit, which looks really interesting. I think I will try to follow that tutorial and see what I think after that: https://medium.com/@conrad_9565/lets-build-a-ui-with-qlkit-and-graph-queries-79b7b118ddac
i recommend giving #fulcro a try as well. it's a batteries-included, easier to get started with, better documented fork of Om Next. the author is active in Slack if you should need to ask any questions, and has created a detailed book, as well as a series of videos to help people learn it. http://fulcro.fulcrologic.com cc @UC5394EGJ
I'm looking for advice on naming conventions for tests in clojure, especially for generative tests using test.check.
Anyone with experience using https://github.com/ptaoussanis/sente? Need to do some real time updating stuff.
@jarvinenemil We built some real time p.o.c. dashboard stuff at work using it -- but that was several years ago.