off-topic

amano 2026-02-22T10:56:10.466179Z

Does anyone use clojure(script) primarily or exclusively in a small (one-man) agency?

doojin 2026-02-25T12:50:01.264399Z

If you want to minimize javascript interop, replicant can help. The author of replicant has almost no javscript interop code in his clojurescript projects.

mauricio.szabo 2026-02-25T13:03:28.721429Z

WASM is not the silver bullet everybody sells. There's a huge cost on conversion. For example, parinfer have a version in Rust that performs orders of magnitude better than the JS version, but if you have a big file (like the clojure.core namespace) then it takes almost a second every keystroke, and like 96% of the time is via sending the full source code text to and from WASM.

doojin 2026-02-25T13:08:58.469899Z

What conversion? Can webassembly remove most of the conversions in the future?

mauricio.szabo 2026-02-25T13:26:48.553809Z

You can't just pass Javascript objects to WASM, you need to convert them. Even strings, numbers, need to be converted. For example, C strings are null-terminated (usually), and JS strings are UTF-16. To pass them to a WASM-compiled C string, you need to allocate WASM memory, copy the bytes from the JS string (re-encoding in the process if C is not using UTF-16, and it usually is not), then as soon as the WASM function runs, copy back the contents from the WASM memory into JS

mauricio.szabo 2026-02-25T13:28:07.651129Z

This conversion part is usually a huge performance hit, and most "WASM good, look how fast it is" articles completely ignore this

doojin 2026-02-25T13:29:17.309699Z

Will webassembly component model not reduce conversion?

doojin 2026-02-25T13:31:08.002169Z

Let's imagine a future when everything is wasm component. Even DOM API is wasm.

doojin 2026-02-25T13:32:02.818769Z

If a programming language adopts wasm component memory model, perhaps there is no conversion required.

doojin 2026-02-25T13:33:24.637909Z

If you can design a copy-less component memory model, perhaps you can eliminate conversion. A unified memory model shared by every wasm language can eliminate conversion.

mauricio.szabo 2026-02-25T15:03:22.324869Z

Unless it's very well designed, I find it hard to eliminate components. For example, C and C++ have completely different "strings". Haskell, too. It's hard to know how I could share a JS string between all three languages without any kind of conversion; then, you need to "share memory" between the JS and WASM VMs, which is basically the opposite direction JS is moving (Electron, for example, disabled some pure memory manipulations for native extensions because it could crash webworkers with node access). To make things worse, JS string are immutable, C, C++, and Ruby are not - how could an unified memory model work in this situation?

mauricio.szabo 2026-02-25T15:05:39.774729Z

I can see some kind of "copy-on-write" or things like that working, but again, this unified model will need to create some "adaptation" of different memory organizations (JS numbers need to appear as integers/floats/doubles to C/C++ for example, without actually stuff), probably for primitives at least (and strings, because these are the biggest cost I believe)

Ahmed Hassan 2026-02-25T16:52:11.307639Z

I have seen libraries in which web worker can run main thread, so expensive computations can run in web worker.

Ahmed Hassan 2026-02-25T20:35:49.286749Z

@mauricio.szabo can't we extend or use latest JavaScript features in .js files and consume them from .cljs files when said feature isn't available in ClojureScript directly?

mauricio.szabo 2026-02-25T20:58:13.892989Z

Yes, but eventually you start to think why you're using ClojureScript in the first place; debugging a code with lots of "glue code" can end up being very tedious, and you lose the best of both worlds... eventually, it gets harder and harder to justify using a different language than pure Javascript

Ahmed Hassan 2026-02-25T21:32:10.733199Z

@mauricio.szabo what do you use for backend when using JavaScript for front-end? Node.js or Clojure or something else?

mauricio.szabo 2026-02-25T22:40:24.890019Z

Well, for my job I use Ruby + Javascript (with all the bull:hankey: that comes with Rails and frontend code) For my personal projects, I don't really have a "frontend" or "backend" - I keep a fork of Atom (so front+back are together in the same codebase) and some Clojure/Ruby/Python plug-ins for it; the fork of Atom is pure Javascript, the plug-ins are ClojureScript (even with all the problems)

doojin 2026-02-26T01:14:12.155819Z

I think "Using JS in ClojureScript Projects" is an acceptable way to interact with javascript. Even in purescript, when you want to interact with javascript, it's best to just write javascript glue code that purescript can understand. If you minimize the number of javascript components you interact with in clojurescript, it shouldn't be too painful.

doojin 2026-02-26T01:17:57.937349Z

> In PureScript, JavaScript code is wrapped using a foreign module. A foreign module is just a CommonJS module which is associated with a PureScript module. Foreign modules are required to adhere to certain conventions:

doojin 2026-02-26T01:18:22.429139Z

Write foreign modules for clojurescript, and don't outsource functionalities to javascript too much.

doojin 2026-02-26T01:28:58.694499Z

https://github.com/WebAssembly/component-model/blob/main/design/high-level/Choices.md says > The component model adopts a shared-nothing architecture in which component instances fully encapsulate their linear memories, tables, globals and, in the future, GC memory. Component interfaces contain only immutable copied values, opaque typed handles and immutable uninstantiated modules/components. So, webassembly forces copying in most cases between languages. But, • It is going to be fast within a language. Right now, clojurescript is not fast. • webassembly component interop will be less painful than javascript interop because webassembly component model will be stable.

doojin 2026-02-26T01:43:03.538909Z

When you write higher-level languages that are very different from the lower-level languages, writing a binding or foreign glue code seems unavoidable. At least, webassembly components can ease the pain of interop. I understand that having to write glue code or tight loops in C when you want to write python is frustrating, but it has to be done. At least, javascript is easier to work with than C.

mauricio.szabo 2026-02-24T15:41:15.962799Z

I am using ClojureScript mainly for my own personal projects. But I must say that I'm only partially satisfied with my decision...

Ahmed Hassan 2026-02-24T17:34:42.087099Z

@mauricio.szabo what's the reason for being only partially satisfied? Are there better alternatives?

mauricio.szabo 2026-02-24T17:43:41.744529Z

There are no better alternatives for now, but I feel ClojureScript is being "left behind". Basically, JS now supports a lot of things that we can't do in CLJS; classes, private methods (these ones are literally unsupported, the Closure Compiler can't parse these), async iterators, template strings etc; these are hard to interop in CLJS, and clumsy to adapt (at best).

mauricio.szabo 2026-02-24T17:45:48.763239Z

There's also the problem of the compilation process too - it's slow, and sometimes generates invalid Javascript; I got into way too many situations where I was developing something just to see it crash under some "undefined is not a function", and after a lot of debugging, discovered that the fix was to remove Shadow-CLJS's caching and re-compile everything.

Ahmed Hassan 2026-02-24T20:02:43.453119Z

TypeScript, VS Code and rest of the ecosystem are also pretty good.

Ahmed Hassan 2026-02-24T20:07:50.896389Z

Back-end/Node.js ecosystem also got better.

Ahmed Hassan 2026-02-24T20:09:14.037979Z

If we look at Clojure(Script) for full stack web development, JavaScript is also a potential alternative, which can perform better in many cases.

mauricio.szabo 2026-02-24T23:29:52.001919Z

Javascript will perform better in most cases. Different from Clojure, where the structures have near-native speed (hindered only by immutability) ClojureScript's structures are orders of magnitude slower than Javascript, unfortunately

mauricio.szabo 2026-02-24T23:30:54.302659Z

But I don't even think this is a problem, to be honest - my problem with ClojureScript is that it became "isolated". It's hard to interop with some libraries because they expect, for example, that you're able to create a class and extend from something and it's hard to do that in ClojureScript (even with Shadow)

doojin 2026-02-25T07:05:53.877249Z

Will javascript interop be improved?

doojin 2026-02-25T07:15:25.577179Z

Perhaps, clojurewasm and webassembly component model can ease the pain in the future.

yunior 2026-02-22T11:33:13.523609Z

I wouldn't say that i'm an agency but for my projects i use only clojure(script).

amano 2026-02-22T12:32:40.602259Z

What are you, then?

yunior 2026-02-22T12:53:56.405379Z

I work as a developer but if I find a freelance job I do it. Apart from that I'm working on some of my own apps.

amano 2026-02-22T12:54:33.069879Z

I want to aggressively reach out to niche owners and solve their problems with simple tiny clojure(script) programs. I have to build and sell.. It will be hard...

yunior 2026-02-22T12:56:02.906399Z

Me too. I like that model.

amano 2026-02-22T12:58:59.858569Z

I don't recommend working on SaaS right away without knowing the market. Agency work makes you learn the market.

yunior 2026-02-22T12:59:32.369059Z

Yeah. I agree!

amano 2026-02-22T13:50:07.541329Z

I decided to stick to a unified clojure(script) stack for as long as possible. Otherwise, I can't build up leverages over time. Even HTML and CSS will be generated from clojure(script) in advance or during the runtime.

yunior 2026-02-22T13:53:07.262819Z

I used htmx for one of my projects.

amano 2026-02-22T13:53:21.686869Z

I will try to use only replicant for UI. I have to specialize in one unified stack. Enormous power comes from specialization.

yunior 2026-02-22T13:54:08.409549Z

I'll take a look into replicat as well.

amano 2026-02-22T13:54:43.323739Z

I chose replicant because htmx and datastar aren't going to be enough, and I don't want to deal with react upstream changes. Replicant is finished and simple and first-class in clojurescript.

yunior 2026-02-22T13:55:22.161729Z

Thanks for the heads up. I see what you mean.

amano 2026-02-22T13:56:27.590899Z

Do you know reagent had to deal with multiple react upstream changes? Even UIx may have to deal with upstream changes at some point. It may be slower to use replicant at first, but you will gain speed over time. If you build on a stable foundation, you will gain leverage over time.

yunior 2026-02-22T13:58:19.421279Z

I'm open to new things. That's why I got into clojure as well.

amano 2026-02-22T13:59:42.253649Z

I just described my supposedly life-time tech stack. If you change tech stack frequently, you can't build leverages. I plan to stick to one tech stack for as long as possible.

amano 2026-02-22T14:00:39.694179Z

Clojure is also being built on webassembly, so we are probably future-proof.

yunior 2026-02-22T14:01:31.016349Z

I intend to stay on clojure as well for the long term.

amano 2026-02-22T14:01:54.406039Z

Cool.