Biff.core: system composition for Clojure web apps

(biffweb.com)

93 points | by jacobobryant 5 hours ago

2 comments

  • lukaszkorecki 3 minutes ago
    Maybe I'm grumpy and old or something, but I wish there was only one Component library for Clojure, out of all the things this should have been the one everyone settled on.
  • holistio 5 hours ago
    Recently my impression has been that whatever the agentic tools are best at is also what's best for solo projects or proof of concepts.

    I used to love writing custom CSS, but Claude is just so much better at Tailwind that I ended up switching, even though I still kind of loathe the class soup.

    Is AI any good at Clojure?

    • iLemming 3 hours ago
      > Is AI any good at Clojure?

      It's okay when you use it just like any other PL, which is roughly the Unix/pipe model - batch-style. Agent spawns process -> reads stdout/stderr -> spawns next process. State lives in-between the calls and in files. Each tool invocation is stateless.

      Things get far more interesting when you give an LLM a true Lisp REPL. LLM stops guessing and starts empirically analyzing current state of things and produces working solution faster, costing far less tokens. And you get to watch it solve things interactively, e.g. I often let AI poke through our UI (via Playwright-driven Clojurescript REPL), while monitoring situation in k8s - through nrepl port, connected to Clojure REPL.

    • jwr 4 hours ago
      AI is very good at Clojure. In fact, from what I can see, I get a much better experience on a large Clojure+ClojureScript code base than many other people. Surprisingly so. I'm still not sure why, is it higher token density of the language? My experience? Large, well-written and well-maintained code base to lean on as context? In any case, the experience so far has been excellent.
    • mechanicum 4 hours ago
      Last year, I thought it was awful. Even Opus would reliably unbalance parentheses on practically every edit and then enter a doom spiral of making things worse as it tried to figure out the right place to put a `)`.

      Recently, I’ve been quite impressed, at least with Claude. At some point they figured out the parens issue, and the code is largely solid and idiomatic. I’ve mostly used it with Polylith apps, so the context for any given change is naturally well-defined. Usual issues with failing to reuse existing functions or make sound decisions about architecture, but no more so than I’ve seen with TypeScript or Rust.

      I think there are a few points in its favour: it’s a very concise language, the documentation is terse but precise and comprehensive, and while there’s obviously nowhere near as much Clojure out there as there is JavaScript or Python, there is a lot. As the Clojure demographic skews toward experienced, senior programmers, I’d guess the quality of that corpus is probably well above average.

      Java stack trace errors might even be an advantage now.

    • devin 1 hour ago
      Maybe I'm just lucky, but I almost never run into paren-matching issues. Hooked to a working REPL, Clojure isn't merely "good", I'd say it is dominant compared to a lot of other langs.
    • kayo_20211030 3 hours ago
      Yes. Generally, it's quite good. It does have a blind spot with parens, but good old Claude Opus then cranks up a python script (yes!) to sort it all out. I wouldn't leave any of the models out on their own - you'll still have to clean up some obviously crazy stuff, but it's pretty clear what needs to done. In conclusion, Claude and ChatGPT are quite decent at Clojure. Oh, I do like Biff.
      • y1n0 2 hours ago
        I would guess the parens will be problematic because of tokenization. something like `)))` is a single token and so is ')])'. I think having strings like that as single tokens probably makes the link between open and closing parens harder to associate. Probably could be papered over with harness help.
    • arikrahman 2 hours ago
      It's the language best positioned for AI with world class nREPL.
    • jacobobryant 5 hours ago
      AI has been working out well for me writing Clojure, both in personal projects and at work. Documentation, not so much... I write all that by hand.

      For Biff I've been using AI to generate a rough draft of all the code and then I take a manual pass over things before releasing. Seems to be a good middle ground.

    • oDot 5 hours ago
      This is a bit of an "XY Problem" question.

      I have migrated all my code to Gleam, FE and BE, Bun, browser, and BEAM.

      Claude knows much less about Gleam than it does about Javascript or React. However the constraints of Gleam and its Elm inspired framework Lustre are so strong, Claude gives me much better results.

      The only difference is I need to adjust my initial guidance.

      • elxr 3 hours ago
        Any favorite gleam projects to learn from?

        I've always admired the direction gleam was heading in, and the community is awesome. But with gradual typing now in elixir, I'm weighing whether or not gleam offers anything special enough to get me spending time there instead of just using elixir.

      • bbkane 4 hours ago
        How are you liking Gleam and Lustre? What went particularly well or badly?
    • michaelmrose 3 hours ago
      It is but it remains shockingly bad at closing sufficiently deeply nested parens at least as far as chatGPT
      • iLemming 2 hours ago
        I bet you're just treating it like any other (non-homoiconic) language. An agent that edits files and re-runs `clj` is doing something fundamentally different from what a Clojure developer typically does. When you give the agent a REPL - things get far more interesting.