6 ms·
Its such a great idea, but the site seems somewhat broken. I have a constant "Connection lost" banner flashing at the top. But I will say that in terms of prod
by lbj 6y ago
Its such a great idea, but the site seems somewhat broken. I have a constant "Connection lost" banner flashing at the top.
But I will say that in terms of productivity, Clojurescript/Reagent has been a real red-pill experience. Functions that compile to both back-/frontend. Seamless data-transfer via Transit (access front-end vars from the backend, no conversions - and simple cljs function compiling directly to React components is a very potent cocktail.
- chimen 6y agoI'm intrigued - what makes it a "red-pill experience" compared to a typical typescript setup for example?
- cutler 6y agoBaked-in immutability for a start. Then there's REPL-driven development, Lisp ergonomics and a real functional core. 'Tis a joy to behold.
- diggan 6y agoFor me, the real game changer is the REPL-driven workflow you get with both Clojure and ClojureScript, but it's really hard to describe the details of how it's different than hot-reloading in the React ecosystem. I've tried many times, but my explanations seems to mostly confuse people rather than enlighten them. So let's use the words of others instead, here is the best explanation I know about why the Clojure REPL rocks: https://vvvvalvalval.github.io/posts/what-makes-a-good-repl.html https://vvvvalvalval.github.io/posts/what-makes-a-good-repl.... Short version is: you can send snippets of code to your REPL from your editor, and because of the common structure of Clojure apps, you can usually evaluate content in the middle of a function without having to change any code. Basically unlimited introspection into a running program. I used to program in PHP, C#, Golang, Ruby, NodeJS/JavaScript (both backend/frontend) and some others, and no language comes close to the dev experience of Clojure. I'm sure other lisps are similar as well, but haven't used anything else than Clojure substantially.
- holtalanm 6y agoI went down the Clojure path once and wasn't nearly as impressed as you were, apparently.
- diggan 6y agoDid you actively get into the REPL workflow? If you didn't, I don't think you took properly advantage of what the language offers. Bit like using TypeScript and using `any` everywhere. If you did get into the REPL workflow, was it not helping you be more productive? Any showstoppers?
- holtalanm 6y agoMy complaints more reside with issues I ran into with the language itself. Mainly, meaningless exception messages and insane stack traces and poor tooling within my editor of choice (at the time). Also, I take issue with a language that touts itself as purely functional, but then builds itself off of the JVM, forcing you to use objects under the hood. You end up with some kind of weird FP/OO Frankenstein's monster that isn't _really_ FP, but also isn't _really_ OO. Also, since it is on the JVM, there is _no way_ you can actually have truly immutable objects or data structures, as much as Clojure likes to think that is the case. It places a lot of trust on the libraries that make up your program not to go into reflection and do some really annoying mutations. If that is the case, I'd rather just use something like Erlang or Haskell which are _truly_ functional languages, not just an OO system masquerading as a functional language. I _really_ like the syntax of lisp, and Clojure provides some really good extensions of that syntax with the way they do parameters, but in the end I just couldn't get over the issues I had with the core of the language runtime.
- diggan 6y agoExceptions and stack traces I agree with you can be a bit ridiculous, probably because I'm not used to Java at all. > Also, I take issue with a language that touts itself as purely functional Seems to be a common misconception that still hasn't died. Clojure doesn't tout itself as a "purely functional" language, and as far as I know, never has. It tout itself as a "practical general purpose" language where you can be pure and impure, depending on what you do. What Clojure does advocate for, is the approach that _most_ parts of _most_ programs should functional, but you should be able to go away from that paradigm when required/wanted. > It places a lot of trust on the libraries that make up your program not to go into reflection and do some really annoying mutations Just for the record, in reality and practical terms, I've never had this happen to me. Now I haven't done Clojure development for more than 2 years or something, but if it was a real problem, I'm guessing I would have hit this at least once before. But never have I had a Clojure library unexpectedly mutate things it wasn't supposed to. So yeah, if you're looking for a purely functional language, go with a language that actually tries to be purely functional, because that's not what Clojure aims for, it aims for practicality.
- lbj 6y agoI appologize for the late reply, its been one of those days :) Im overdue for a blogpost on my Webdev setup/stack, but in short the main power comes from 1) Seamless transfer of data from back- to frontend and vice versa. If my DB contains a DATETIME I can load this in Clojure as a java.sql.Timestamp and pass it to the browser where its converted to a js/Date - Free data-sharing between front- and backend is a big productivity boost. 2) My usual backend Cloure code, also works in the frontend. That means I can move functions or use libs in the browser that also work in the backend - It also means that my Javascript code is now fully functional, which means 10x shorter and about 10x more robust. 3) Everything is REPL driven. Anything surprising happens in the browser I can inspect those vars that are effected in the REPL, toy with them, fix problems and update instantly. Hunting bugs is much faster this way. 4) Clojurescript functions compile to React components, zero boiler-plate: (defn banner [img txt] [:div.bannerclass [:img {:src img}] [:h1 txt]]) as an example. Thats a complete component, it will only update when the params update. But like I said, its a bigger talk that I'll hopefully have some time to dive into sooner rather than later.
- Garlef 6y ago> Seamless data-transfer via Transit (access front-end vars from the backend, no conversions Very interesting! A quick search did not yield any results. Could you provide a link to some article or code examples explaining this?
- diggan 6y agoklipse.tech usually have good introduction material for various Clojure topics, including Transit! Here is a good breakdown with examples too: https://blog.klipse.tech/clojure/2016/09/22/transit-clojure.html https://blog.klipse.tech/clojure/2016/09/22/transit-clojure.... Otherwise the canonical source is here: https://github.com/cognitect/transit-format https://github.com/cognitect/transit-format
- motform 6y agoIt should also be noted that, at least in my experience, you don't use the transit readers/writers directly as in the example post, but have a library like https://github.com/metosin/muuntaja https://github.com/metosin/muuntaja do that for you.