News for hackers. Stuff that matters.
Re:Gleam, Coming from Erlang by greener_grass on Friday February 28, 2025 @09:22AM (#43205895)
This already exists with F#, OCaml, Scala, Haskell... it doesn't seem to be a big draw.
Re:Gleam, Coming from Erlang by h14h on Friday February 28, 2025 @10:06AM (#43206407)
Somehow didn't know this --I can't help but wonder why.

The effort to make JS work on the server has been much more successful than any attempt to make server languages work on the client. Nothing jumps out to me as an obvious technical reason this is the case -- maybe it's moreso an imbalance in effort & attention?

Re:Gleam, Coming from Erlang by ameliaquining on Friday February 28, 2025 @12:15PM (#43207963)
DOM APIs are only available in JavaScript, so doing things in the browser in a non-JavaScript language requires FFI—and it's a general truism of programming that FFI tends to be a pain point. Languages that target client-side app development try to compensate for this by offering language-native DOM abstractions of higher or lower quality, but usually you end up having to do something that these abstractions didn't anticipate, and/or incorporate a third-party library from npm, which forces you back into FFI. On the server it's much rarer for some critical piece of functionality to be available only in one language, because the server environment itself is language-agnostic.
Re:Gleam, Coming from Erlang by greener_grass on Friday February 28, 2025 @12:47PM (#43208354)
F# allows you to use React pretty much directly, but it has still been only a modest success.
Re:Gleam, Coming from Erlang by ch4s3 on Friday February 28, 2025 @06:16PM (#43213096)
I think F# suffers from being a second class citizen to C# inside of Microsoft. If it ran on a different VM or got more attention it may be more popular. It seems quite nice.
Re:Gleam, Coming from Erlang by greener_grass on Monday March 03, 2025 @04:37AM (#43240032)
Without access to the .NET ecosystem it would be dead in the water
Re:Gleam, Coming from Erlang by grndn on Friday February 28, 2025 @02:00PM (#43209069)
As another comment said, you can write client side code in F# which gets transpiled to JS, just like Typescript or CoffeeScript. This approach allows you to use JSX components directly from your F# code. It's very cool. Other FP languages have something similar.

https://www.compositional-it.com/news-blog/fsharp-react-seri...

Re:Gleam, Coming from Erlang by AlchemistCamp on Friday February 28, 2025 @07:02PM (#43213670)
I suspect a lot of people who might otherwise go to F# are using ReScript for React.
Re:Gleam, Coming from Erlang by hombre_fatal on Friday February 28, 2025 @12:26PM (#43208123)
Server application development is just much different than UI/client development.

It's easy to make JS work on the server like it's easy to make anything viable on the server: it's just one machine running your code, and the runtime only has to interoperate with a well known interface (the OS) that barely changes. And then consider that a web server's interface to the "user" is over a single, abstract port.

In a browser application, you have to interface with JS to drive the UI building blocks (DOM and company). And the web API is async. And you have to build an interactive UI. And abstractions on top of all this are extremely leaky because they are hard to simply paper over and pretend they don't exist like you can on the server.

Often when I see a JS replacement on the browser, it seems to offer very little over JS beyond "hey look, it's not JS" which just isn't enough to justify the penalty.

Finally, the hard part of UI development is stuff like state management and deciding when things should rerender. Switching to a different language alone doesn't give you that. Figuring out a solution in JS, like MobX + React for example, probably does more for you than trying to make a whole new language work.

Re:Gleam, Coming from Erlang by mamcx on Friday February 28, 2025 @02:24PM (#43209290)
> Somehow didn't know this --I can't help but wonder why.

JS being the monolithic tyrant that other tyrants see with envy doesn't help.

In the server and elsewhere you have several major langs with big enough sub-cultures and a stablished ethos of sharing, even if that mean the second biggest tyrant of C.

JS developers overshadow any other tribe, so that mean that population could have much less exposure to polyglot alternatives.

And then all that libraries, that are made to make sad any FFI you can trow at it.

Re:Gleam, Coming from Erlang by klabb3 on Friday February 28, 2025 @02:51PM (#43209576)
> JS being the monolithic tyrant

There are probably tens of thousands of developers waiting in line to switch out JS. The reason they can’t is not even that it can’t run in the browser (many can) but that it interacts with the DOM natively, which makes it the only language that can be used in the browser without masochism. In turn, the DOM is the only UI that is truly cross platform, which makes it the by far best and cheapest option because everything else is either hobby or proprietary in 10 different flavors depending on which fiefdom you build your product in. Basically, JS isn’t popular because of ability, but its interoperability.

The effort & money that has been poured into tech after JS was created would dwarf anything beforehand. Yet, we live today by the open standards that were developed before Bezos etc started purchasing private islands. So I’m a little hesitant to blaming JS for being backwards when the rest of the world couldn’t come up with an alternative despite having 1000x (not an exaggeration I think) more time and money to do so.

Re:Gleam, Coming from Erlang by hamandcheese on Friday February 28, 2025 @09:17PM (#43214902)
Choosing not to use JS on the frontend is much riskier than choosing to use JS on the backend, IMO.