Fork me on GitHub

I'm currently picking up JavaScript to use Meteor to build my startup. Though I am also learning a bit of Clojure/Script where I can to improve my programming and possibly use it where I can or where I have to build my own service then perhaps link it up by using a Microservices architecture. I'm wondering whether there is really much need for me to learn Java to make use of the Java libraries in Clojure. Or would it be best to just focus on ClojureScript purely. Node seems to be incredibly popular meaning more libraries will grow and mature, there will be more and more speed optimisations, on top of that there is a lot more places I can run my code when I can target Node. The only real benefit I see with the JVM is multithreading. Can anyone comment to this?


@grounded_sage disclaimer, I never used Node myself. 1. Where can I run node, where the JVM cannot run? 2. All the libraries that are growing in the node ecosystem are most probably already there in the JVM ecosystem (talking about 20 years versus 5). 3. No matter how much speed optimisations you make within node, it still will be slower than programs on the JVM in most of the cases. Not even talking of multithreading here. Tbh. I never understood the hype around node. The only advantage that I see is that I can write backend code, even if I only know JavaScript, so there is no need to learn a new language for some. So, yes it is OK to stick with with cljs only, if you can live with the limits of node. But if you want a fast, multithreaded and mature ecosystem, choose java...


Or clojure ;-)


@sveri: Well I'm a designer and entrepreneur who is also interested in programming. So learning Java isn't something I am interested in unless there is significant benefits for learning another whole new language, runtime and clojure interoperability. I get that there would already be libraries already existing on the JVM but with the big push from business on Node I would say the libraries and speed will be good enough and eventually reach a point it would eclipse JVM outside of the whole multithreading thing (which I still don't fully get). The popularity is exactly what you said you can use basically the same language. Which is one of the key benefits of Clojure/Script aside from immutability etc. partly the reason why I am here. Looking to do as much as I can without having to become a full time multilingual computer science student. :p If I really need to use JVM At least ClojureScript will make it so I am somewhat familiar.


OK, that makes sense, use the language that you know, are familiar with. BTW, not sure if you are aware of that, clojurescript compiles to JavaScript and clojure to bytecode running on the JVM. If the performance of node is enough to fit your project, is something only you can judge, which is perfectly fine. Still, that node can outperform the JVM most of the times is something I want to see proven, until then, I don't take that argument :-D


@sveri: yea that's the conclusion I am drawing. I'm interested in the ClojureScript in ClojureScript compiler and whether that would allow me to build with Meteor in ClojureScript.. Would make for fast development. The way I see it if I hit roadblocks I'll just jump over to Clojure instead of learning Go like a lot of other Node people seem to do for performance. Etc


Hi everyone. when i use clj->js on a clojure map like {:myns/test "test"} it will return a js-object without the namespace: {:test "test"} how can i prevent this behavior? on the other hand, can i tell the reverse function js->clj to add a namespace to every prop?


It'll always use name so will remove the namespace. You can implement IEncodeJS for Keyword type though and do your own de- and encoding


I'm having some trouble figuring out how to combine routes in compojure. I want to have my base "/some-core-page" routes defined in core.routes, and "/some-context-page" routes defined in context.routes, and tying everything together using the 'routes' macro in my main app handler. Can't seem to get it working properly and I'm pretty sure I'm doing something dumb. Does anyone have any good links that explain how to combine routes using different namespaces, in more detail than the compojure wiki?


@shaun-mahood: Which server are you using?


Oh sorry, using lein ring right now, just trying to figure it out in dev


What does your handler look like?


@shaun-mahood: Yeah, like what he said...


(def app
  (-> (routes other-routes core-routes)


I can get to everything from my core-routes namespace, but nothing from the other-routes namespace


It works if I move everything into the same base namespace, so I'm guessing I'm doing something wrong with the namespaces rather than the routes, I'll try and narrow it down from there. Thanks.


they have to be ns qualified


Yeah I've done that, must be somewhere else I'm going wrong


try doing something wrong 😉


I'm good at that!


Hi, what is the correct way to add jmx options to a lein project?


I tried a many but none of them is working.


I am trying to profile remote server.


@shaun-mahood: When I have had issues in the past I assumed it was my ClojureScript, it might be the pages themselves or the functions (other-routes). My point is you may have the routing correct...


@markstang: I found the problem - I was missing a set of brackets in one of my route definitions and just didn't see it. Always a stupid mistake... thanks for the help.


I am sure there was an error you missed 😉


Are there any beginner-Clojurian/new-to-the-JVM guides on logging?


I feel like I have a hazy idea as to how slf4j/logback/log4j fit together, but something to condense it all would be super helpful (bonus points for what it means for people using Clojure)


bcobb: Not sure if this will help but you might want to take a look at it:


@meow: looks like a nice library, thanks for passing it along -- has some stuff that looks interesting and relevant, too


@bcobb: cool, thanks