S
Stuart Sierra
stuartsierra.com · Personal blog · on HN since 2007
Stuart Sierra, a Clojure developer, writes about Clojure style, performance pitfalls and software design.
What HN saysCommenters cite his articles on threading macros and Clojure community attitudes, and his Thrift versus Protocol Buffers comparison.
51HN people shared it
16linked it in comments
55stories submitted
1.5Kstory points
2 years agolast shared
2007people per year2026
Most-shared posts
- 1Clojure Start Time in 20196 people · 12 points · first shared 2019 · discussion on HN
- 2Threading with Style4 people · 1 points · first shared 2019 · discussion on HN
- 3Clojure Don'ts: Concat3 people · 21 points · first shared 2015 · 2 comments on HN
- 4On the Perils of Dynamic Scope3 people · 4 points · first shared 2013 · discussion on HN
- 5Clojure 2015 Year in Review2 people · 223 points · first shared 2015 · 27 comments on HN
- 6Objects Are Not Abstract Data Types2 people · 69 points · first shared 2009 · 13 comments on HN
- 7Heating Up Clojure & Swing2 people · 65 points · first shared 2010 · 2 comments on HN
- 8Apathy of the Commons2 people · 64 points · first shared 2016 · 19 comments on HN
- 9What Is a Program?2 people · 9 points · first shared 2011 · discussion on HN
- 10Facebook's Thrift vs. Google's Protocol Buffers2 people · 8 points · first shared 2008 · 1 comments on HN
- 11The Reluctant Dictator2 people · 5 points · first shared 2013 · 1 comments on HN
- 12Clojure donts thread as2 people · first shared 2018
- 13Clojure 2014 Year in Review1 people · 261 points · first shared 2015 · 115 comments on HN
- 14How to Name Clojure Functions1 people · 120 points · first shared 2016 · 34 comments on HN
- 15Clojure 2011 Year in Review1 people · 114 points · first shared 2012 · 30 comments on HN
What HN people wrote when they linked it
dimitar · 2021-01-03
While everyone is entitled to their own opinion, I think it is worthwhile to give more detailed examples - like for example slow compared to what?
For example there is a nice discussion over slow startup (note that for the most people the impression that it is slow comes from the Leiningen startup which starts two JVM processes): https://stuartsierra.com/2019/12/21/clojure-start-time-in-2019
robto · 2018-08-02
In clojure, you can do this with as->, but there are reasons to be careful. Stuart Sierra has a great (brief) article about it[0]. The long and short of it is that it's really easy to change the "type" of an expression as it goes through your pipeline in unintuitive ways. This can cause surprises later down the line, so it's probably better to refactor the functions you are calling so that they play nicely with thread-first or with thread-last.
[0]https://stuartsierra.com/2018/07/15/clojure-donts-thread-as
loevborg · 2016-04-19
I agree with most of the recommendation in this article (thanks for publishing it!), but the advice about futures should be taken with a grain of salt. You need to be careful with futures because they swallow exceptions. However, the solution given (setting a global exceptions handler), while sound advice in general, doesn't actually solve the problem of hidden errors, as futures catch all exceptions and return them (so the caller can handle the failure in whatever way it prefers).
If your goal is "fire and forget" behavior (e.g. sending off a confirmation email), then it's better to use java.util.concurrent.Executors directly. It's actually easier than it sounds: https://gist.github.com/pesterhazy/c41786690ee0f8a3e5a21f88fa4a486a. Also see https://stuartsierra.com/2015/05/27/clojure-uncaught-exceptions
moomin · 2013-06-25
Don't agree with 1&4, but 2&3 are subsets of a feature of the Clojure landscape: the guys behind Clojure aren't laser focused on driving adoption like, for instance, Scala is.
Indeed, some of them don't really like the idea of a "Clojure Community".
http://stuartsierra.com/2013/01/16/the-reluctant-dictator
On the other hand, there's an amazing focus on doing the right thing rather than throwing features at a wall, which I like immensely. Sadly, long lists of new features seems to drive adoption. :(
wayne · 2008-10-05
Here's the big Thrift/PB comparison table: http://stuartsierra.com/2008/07/10/thrift-vs-protocol-buffers
Personally, I like Thrift better. More languages and greater community participation.
twism · 2023-02-18
Maybe what you are looking for is threading https://stuartsierra.com/2018/07/06/threading-with-style
igouy · 2022-05-09
> We all know Java is slow to start up…
More specifically, Clojure —
https://stuartsierra.com/2019/12/21/clojure-start-time-in-2019
capableweb · 2021-09-10
Just to add some reference to why it can take a long time to start a REPL (for example):
> As it turns out, Clojure start time is a complicated and multi-dimensional topic. Clojure projects are slow to start not only because of JVM — JVM itself starts in ~50 ms — but because of JVM specifics the classes are loaded slowly. Clojure projects are slow to start not only because of Clojure — Clojure itself starts in ~1 second — but because of Clojure specifics, the namespaces, especially not AOT-compiled one, are loaded slowly. And so on.
http://clojure-goes-fast.com/blog/clojures-slow-start/
A more recent comparison of Clojure, Java and some other Clojure-inspired languages:
https://stuartsierra.com/2019/12/21/clojure-start-time-in-2019
nathell · 2019-08-24
Also relevant, Stuart Sierra's opinionated guide to threading macros:
https://stuartsierra.com/2018/07/06/threading-with-style
https://stuartsierra.com/2018/07/15/clojure-donts-thread-as
rjeli · 2017-05-26
ok, found it: https://stuartsierra.com/2008/08/08/clojure-for-the-semantic-web
I think it was in reference to the java ecosystem, more than "a better way to write java," although I still see it that way.
canweriotnow · 2014-04-22
Even in C, always remember the rules of Macro Club[1]:
1) You do not write macros.
2) You do not write macros that violate expectations of normal code behavior.
3) If this is your first time, you must write a macro.
4) Don't think object-oriented.
5) No shirt, No shoes, No dynamic scope.
6) Don't create new scoping rules.
[1] http://stuartsierra.com/download/2010-10-23-clojure-conj-macro-club.pd…
puredanger · 2011-06-23
I would nominate Stuart's dependency mgmt blog entry for this page too:
http://stuartsierra.com/2011/06/01/dependency-management
gtani · 2010-01-29
I haven't done any GUI's in clojure, but i think swing is best doc'd, stuart Sierra series:
http://stuartsierra.com/2010/01/03/doto-swing-with-clojure?0.004707886…
http://stuartsierra.com/2010/01/02/first-steps-with-clojure-swing
--------------------
or SWT:
http://berlinbrowndev.blogspot.com/2009/02/doing-it-wrong-fun-with-clo…
http://www.li-am.com/2009/08/button-in-eclipse-swt-clojure.html
http://www.li-am.com/2009/08/swt-is-alive-from-clojure.html
http://www.li-am.com/2009/08/jface-examples-in-clojure.html
----------------
there's also bits on Qt and JWT, search for them
Barrin92 · 2023-12-06
the code doesn't need anything, people reading it do. Names are useful because they make intent explicit. Point free programming in functional languages is often overused. Stuart wrote a good blog post about this a few years ago.
"All too often, however, I see the threading macros used in places where they make the code less clear. Early in Clojure’s public existence, there was a fad for “point-free” programming, a kind of code golf without any local variables. This is a fun exercise, but it does not lead to readable code, and I’m relieved that the enthusiasm for this style has worn off. What has remained is a tendency to use threading macros any place they can be made to fit. I think this is a mistake. Rather than making the code easier to read, it makes it harder, forcing the reader to mentally “unwind” the syntax to figure out what it does."
https://stuartsierra.com/2018/07/06/threading-with-style
etatidem · 2019-08-30
I like the suggestion in namespace aliasing in https://stuartsierra.com/2015/05/10/clojure-namespace-aliases:
As a general first rule, make the alias the same as the namespace name with the leading parts removed.
(ns com.example.application
(:require
[clojure.java.io :as io]
[clojure.string :as string]))
Keep enough trailing parts to make each alias unique. Did you know that namespace aliases can have dots in them?
[clojure.data.xml :as data.xml]
[clojure.xml :as xml]
Eliminate redundant words such as “core” and “clj” in aliases.
[clj-http :as http]
[clj-time.core :as time]
[clj-time.format :as time.format]
Then you can see immediately what `d` is...
Namely:
(require '[dk.ative.docjure.spreadsheet :as spreadsheet])
(You would still not know the library and might have to ask the same question, but it makes more sense.)
About `d`:
There are always exceptions. For example, some namespaces have established conventions for aliases:
[datomic.api :as d]
616c · 2016-07-19
The problem is, and I think in the case of Github he makes his rationale plain and clear:
> I don’t think it would be right for Emacs to use github.com. I don’t even think it is right for ENSIME to use github, but I’m scared of moving in-case we lose contributor momentum. The FSF gave github.com a bad score and it’s not libre, which makes me nervous.
This is what scares me about the power of GH too. But let's be honest, as this came up with Stuart Sierra yesterday as well in his post on open source rewards stupid bug fixes and not hard work.
https://stuartsierra.com/2016/07/18/apathy-of-the-commons
If the work is boring, people won't do it.
A corollary: if the tooling sucks, people avoid the tooling, and then things stay on the backburner and never complete.
I hate the whole Slack/Gitter/IM channel as well, but the idea of avoiding tooling (e.g. git), which did take Emacs forever, leads to far less contributors like me.
Can we at least work on documenting contributor workflow? How do I build an Emacs test environment and harness system? These things must be bookmarked to emacs-devel and other mailing lists on MARC archives and what-not, as I have yet to find even good blog posts (not that I say that as a standard, but in this case more of what I don't want) of how to set this up.
I do not expect a Github wiki linking to a Gitter channel about setting up a Docker dev containter for emacs-25.x, but can we at least have better tooling for pulling from git repos and…