Live data from Hacker News

Using Clojure for Web Apps

github.com

81–90 of 122 posts

Re: Using Clojure for Web Apps

#81
post #49
post #29

Earlier quoted context omitted.

It sort of guarantees that in a couple of years time half your stack will then be unmaintained, though (at least in my 10 years of Clojure experience).

I get it, you want to be up to date all the time, but often the case is that lib is just done, it does what it says it does, so that is why lib was last updated x years ago.

Nonsense.

This might have been true back in the day before security issues were a thing, but it no longer holds true.

Particularly the case in public web apps.

If someone isn’t maintaining it, don’t use it.

(Obviously it depends; for a test framework, clearly not true, but for example for the “LEGO block” you pick for auth, or say, XML parsing... yes, it matters; the point here is specifically that the “take what you want” approach to a web framework results in scattered maintenance models for different components, and that is categorically bad for long term maintenance of a web app)

Re: Using Clojure for Web Apps

#82
post #72

I love Clojure and take every chance to use it, but unfortunately it’s very much behind the curve. Building web apps is more and more about tying together managed services with short scripts (aka serverless). This means that most app developers never have to deal with the hard technical problems that Clojure was designed to solve and Clojure’s slow startup time on the JVM makes it unfeasible for serverless functions.…

> Clojure’s slow startup time on the JVM makes it unfeasible for serverless functions

GraalVM could totally change this.

Re: Using Clojure for Web Apps

#83
post #67

Earlier quoted context omitted.

The first example is missing the scope brackets likely enclosing the expressions, and there should probably be a few semi-colons.

>The first example is missing the scope brackets likely enclosing the expressions Sure, but so is the Clojure one. So I guess it's more like: fun bar () { let x = 5, y = 10 foo(x,y) } vs (defn bar [] (let [x 5 y 10] (foo x y)))

1st example: 10 symbols: (){=,=(,)} 2nd example: 10 symbols: ([]([]()))

Re: Using Clojure for Web Apps

#84
post #79
post #47

Earlier quoted context omitted.

Clojure has the same number of parens as Javascript, C/C++, Java, and similar languages have parens+squiggle-brackets. (print "foo") vs print("foo"). same same. There's so much more to it than this. I can say without reservation that people who do not take a couple/few weeks to learn a Lisp just do not know what they are missing, and their arguments against it are viewed as children who lack enough experience to know…

Oh sure what’s the number of parens for (+ 1 (* 2 (/ 3 4))) in C? Granted, you don’t have to bother with precedence in Lisp

I'd bet there have been more bugs related to implicit operator precedence compared to ( ) explicit. And given that it's numeric operations, I'll bet some were very costly...

Re: Using Clojure for Web Apps

#85
post #3

Pretty simple Webapp that you could have done 7 years ago. That not necessarily a bad thing but I wouldn't develop a webapp with those tools. Specifically the 'Component' library. I really didn't enjoy working with it and it one of the most complex to understand parts of our web application. So while this seems like a fun set of slides (I have not watched the presentation yet), it's not what I would call a great intr…

What a surprise that the stateful edges of the application are the most complex! I didn't mind component in the past but we just started a project with mount and I really dislike working with that. Seems like there are a lot of ways to shoot your own foot with any of these libraries because there is no "one true way" to integrate them into an application. I haven't tried integrant yet but everyone and their dog seeme…

From my experience with mount, smaller blocks composed in higher order functions which except/use parts depending on config maps etc. are key to leveraging it. It's amazing to have an app built up of composable dependencies which just click together depending on your codes dependency tree though. I found the win was thinking about what exactly was needed for each part of the app and then not fighting but embracing that tree.

Re: Using Clojure for Web Apps

#86
post #67

Earlier quoted context omitted.

The first example is missing the scope brackets likely enclosing the expressions, and there should probably be a few semi-colons.

>The first example is missing the scope brackets likely enclosing the expressions Sure, but so is the Clojure one. So I guess it's more like: fun bar () { let x = 5, y = 10 foo(x,y) } vs (defn bar [] (let [x 5 y 10] (foo x y)))

The clojure example was not missing the "scope brackets". That's exactly what let is. The equivalent c like in your first example should just be enclosed in brackets.

Re: Using Clojure for Web Apps

#87
Clojure and Elixir (Erlang) are my favorite languages. When you get to the point where the parens and brackets just melt away and you have this awakening.

It makes me wish José (creator of elixir) would have chosen Clojure syntax instead of Ruby.

Re: Using Clojure for Web Apps

#88
post #72

I love Clojure and take every chance to use it, but unfortunately it’s very much behind the curve. Building web apps is more and more about tying together managed services with short scripts (aka serverless). This means that most app developers never have to deal with the hard technical problems that Clojure was designed to solve and Clojure’s slow startup time on the JVM makes it unfeasible for serverless functions.…

> Clojure’s slow startup time on the JVM makes it unfeasible for serverless functions GraalVM could totally change this.

Clojure uses too much runtime reflection. I tried many iterations of compiling different server projects with Graal and none worked. I could get simple programs to compile with an older clojure version, but nothing with recent code.

Re: Using Clojure for Web Apps

#89
post #47

Earlier quoted context omitted.

Clojure has the same number of parens as Javascript, C/C++, Java, and similar languages have parens+squiggle-brackets. (print "foo") vs print("foo"). same same. There's so much more to it than this. I can say without reservation that people who do not take a couple/few weeks to learn a Lisp just do not know what they are missing, and their arguments against it are viewed as children who lack enough experience to know…

>(print "foo") vs print("foo"). same same. If you look at things other than function calls, it starts to look different: let x = 5, y = 10 foo(x,y) vs (let [x 5 y 10] (foo x y)) I actually like Lisps and think the S expression syntax is one of their best features, but I'm not going to pretend there are the same number of brackets in Lisps as there are in C family languages.

I once took some small but substantial pieces of code I'd written in Java, ported it to Lisp, and counted the grouping characters in each. Java had fewer parens, but many more grouping characters {}[]() overall. I think it was in the neighborhood of 50% to 100% more.

It's easy to prove anything with a sufficiently small micro-benchmark. But "one line of Java" is not equivalent to "one line of Lisp", and even if it were, nobody writes Lisp code in a style that looks like a one-to-one mapping of some Java code.

This is like complaining that Japanese is inefficient because it has thousands of characters, or that English is inefficient because it takes dozens of characters to say what only takes a couple in Japanese. The concepts aren't exactly the same, and you can't just pick a trivial example and conclude that "this has fewer than that".

Re: Using Clojure for Web Apps

#90

Some of my favorite Clojure libraries in this space: - instaparse: takes EBNF (and other formats) as a string and gives you a parser instantly (!!!) https://github.com/Engelberg/instaparse - re-frame: React-Redux alternative that IMO is much easier to work with https://github.com/day8/re-frame - reagent: React wrapper https://reagent-project.github.io/ - ring https://github.com/ring-clojure/ring - fulcro https://gith…

See also this by the same people as re-frame: https://github.com/Day8/re-frame-10x
Post reply on HN