8/3/2026 at 10:00:51 AM
> And because Bonsai is written in OCaml, it becomes possible to use the same language and types on both the backend and frontend.Finally! I was waiting for this to become possible!
by flufluflufluffy
8/3/2026 at 7:34:28 PM
Why wait? It’s been possible since forever. I wrote UI in OCaml eight years ago. https://github.com/kccqzy/drawing-guessing/blob/master/clien...by kccqzy
8/3/2026 at 1:06:00 PM
There's also Fable for F# but I believe this commenter is being sarcastic. Javascript is a common backend language.by deciduously
8/3/2026 at 10:29:02 PM
I’m that ridiculous person who would rather learn OCaml from scratch if it meant I never had to use JSKidding of course. Mostly.
by xp84
8/3/2026 at 11:04:22 PM
I'd rather learn MUMPS or COBOL than use JS... not kidding.by shawn_w
8/3/2026 at 3:19:54 PM
A really great place to reach for this is Elixir/Phoenix now that the set theoretic type system is in place with LiveView. I have been doing some pretty large/complex codebases gradually working towards fully integrating working this way for the past 5 years and it has been great.by rhgraysonii
8/3/2026 at 10:59:31 AM
Similar attempts include Scalajs.The general challenge becomes integrating the fractional front-end code written in your backend-language that compiles to JS with the rest of the JS ecosystem.
JaneStreet have a love of writing their own stuff from scratch so it doesn't apply to them but it might to you.
Hence most people end up with frontend-as-backend rather than backend-as-frontend.
by philipwhiuk
8/3/2026 at 4:30:34 PM
KotlinJs and ClojureJs too. You always end up having to write wrappers or dealing with problems that would just work if you just used normal js/ts.by vips7L
8/3/2026 at 6:49:38 PM
Clojurescript not ClojureJs, and Typescript doesn't run in the browser, it has the exact same issues/limitations: it must be compiled to JavaScript first.by gleenn
8/3/2026 at 7:00:22 PM
Compiling TypeScript is just stripping out typesby warpech
8/3/2026 at 10:15:16 PM
Isn't that like saying the Internet is only written in English if you strip out all the non-English. All C-style languages are fully cross compatible if you only use semicolons.I can't write Typescript into a browser without cross-compilation and "stripping out types" involves parsing and manipulating code. That's a different language.
by gleenn
8/3/2026 at 7:38:15 PM
That is true only if you confine your TS code to be pure JS plus type annotations.There are TS constructs that require compilation into equivalent JS, such as enums and namespaces.
by Stratoscope
8/3/2026 at 7:58:22 PM
Are there any other?Namespaces are heavily discouraged. Some teams still use enigma but most people in the know us unions of strings.
I know the TS team regrets enums and I have not seen any plans for adding additional keywords that break type stripping.
by hermanradtke
8/3/2026 at 9:24:36 PM
The other one I read about was parameter properties in constructors.And thank you for the correction! It was quite a few years ago that I used TypeScript, and I think the landscape was different then.
Making things even fuzzier in my mind, this was an Angular project, and it was hard to keep track of what was Angular and what was TypeScript.
It sounds like people these days actively avoid the parts of TypeScript that require translation into different JS code.
by Stratoscope
8/3/2026 at 8:16:09 PM
"fortunately" we can load swc compiled to wasm to deal with that.by p_l
8/3/2026 at 8:16:58 PM
absolutely nobody used those outside of a language demo. We also got --erasableSyntaxOnly last year to remove them from the language. The TS team considers them “mistakes“ for a really long time nowby igl
8/3/2026 at 9:29:39 PM
Thanks for the correction! It was a long time ago that I used TypeScript, and making things worse (for my memory) it was an Angular project.So today, most people and teams avoid the parts of TS that require compilation into different JS, and --erasableSyntaxOnly lets you enforce this, right?
by Stratoscope
8/3/2026 at 10:00:41 PM
Exactly. There is plenty of code change however introduced by bundlers who do “bundling“, polyfill injection, minification, this kind of stuff.by igl
8/3/2026 at 10:16:37 PM
Except TS has much wider community support. The type definitions/wrappers are already written.by vips7L
8/3/2026 at 12:34:36 PM
Yup, and Clojure/ClojureScript!by nobleach
8/3/2026 at 11:28:49 AM
Couldn't WASM solve that problem once and for all? Is there some limitation that WASM has that JS doesn't?Disclaimer: I am very inexperienced at front-end development.
by lbourdages
8/3/2026 at 11:48:00 AM
> Is there some limitation that WASM has that JS doesn't?You need a JS trampoline to call your WASM and make browser primitives available to it, and IIRC calls into browser code incur some extra overhead, but those are pretty manageable.
Additionally: for high level languages, source code is _much_ smaller than compiled binaries. If your initial needs are simple, your users are likely downloading more than 10x as much code.
by danielheath
8/3/2026 at 1:40:45 PM
WASM does not (yet) have access to the DOM or web APIs, meaning every direct interaction with the browser must first go through JS interop anyways, with a resulting performance penalty. There are proposals, and maybe we'll see it happen by 2035, but as of now WASM is best suited for heavier workloads where the edge in application performance outweighs the cost of JS interop with the browser rather than being a universal solution.by applfanboysbgon
8/3/2026 at 11:33:31 AM
Such attempts are quite common. Some I remember:https://ocsigen.org/ in Ocaml too
https://websharper.com/ for fsharp and csharp. Really good when I used in in fsharp
Maybe https://melange.re/v7.0.1/ too? (Not sure)
by raphinou
8/3/2026 at 1:00:01 PM
I took this as a joke in reference to the popularity of JavaScript on the backend for the last two decades.by vintermann
8/3/2026 at 1:12:30 PM
that's because most people's intro to CS was how to build a webpage.by reactordev
8/3/2026 at 7:01:11 PM
Modern web development is more like computer alchemyby zero_bias
8/3/2026 at 1:53:37 PM
> Finally! I was waiting for this to become possible!Sarcasm?
Do you want to have a talk as to why JaneStreet wasn't built on JavaScript?
by TacticalCoder