flufluflufluffy
5 hours ago
> 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!
rhgraysonii
10 minutes ago
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.
deciduously
2 hours ago
There's also Fable for F# but I believe this commenter is being sarcastic. Javascript is a common backend language.
philipwhiuk
5 hours ago
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.
raphinou
4 hours ago
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)
vintermann
3 hours ago
I took this as a joke in reference to the popularity of JavaScript on the backend for the last two decades.
reactordev
2 hours ago
that's because most people's intro to CS was how to build a webpage.
lbourdages
4 hours ago
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.
danielheath
4 hours ago
> 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.
applfanboysbgon
2 hours ago
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.
nobleach
3 hours ago
Yup, and Clojure/ClojureScript!
TacticalCoder
2 hours ago
> 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?