News for hackers. Stuff that matters.
Re:Elixir – Why the dot (when calling anonymous functions)? by arturkane7 on Monday August 14, 2023 @02:24PM (#37124647)
What’s currently the best static typed language for web development?
Re:Elixir – Why the dot (when calling anonymous functions)? by bnchrch on Monday August 14, 2023 @02:39PM (#37124868)
Typescript, by a large and deserved margin.
Re:Elixir – Why the dot (when calling anonymous functions)? by ak_111 on Monday August 14, 2023 @02:46PM (#37124998)
Should have added other than Typescript :)
Re:Elixir – Why the dot (when calling anonymous functions)? by bnchrch on Monday August 14, 2023 @02:54PM (#37125144)
Then I would vote Go (best stdlib in the business), then Java.
Re:Elixir – Why the dot (when calling anonymous functions)? by weatherlight on Monday August 14, 2023 @04:50PM (#37126635)
It's not sound :(. Type systems should be bomb proof or get out of the way.
Re:Elixir – Why the dot (when calling anonymous functions)? by mjhay on Monday August 14, 2023 @08:45PM (#37128731)
Typescript's unsoundness isn't a good thing, but it is way down the list of type-unsafe things inherent in the Boschian nightmare that is frontend development.

Compile-to-JS languages add a big impedance mismatch when you inevitably need to use JS libs. Typescript's JS + types philosophy helps with this issue (it still sucks though).

Re:Elixir – Why the dot (when calling anonymous functions)? by deathtrader666 on Monday August 14, 2023 @03:01PM (#37125278)
Rescript
Re:Elixir – Why the dot (when calling anonymous functions)? by giraffe_lady on Monday August 14, 2023 @03:48PM (#37125918)
ReScript is excellent. Same type system as ocaml, which is IMO the sweet spot between power and straightforwardness. You lose the "you can represent ANYTHING" capability of TS which is both a pro and a con. In exchange it's much simpler to work with and has excellent type inference for day to day work.

The externals binding system for JS libs works well for integrating libraries. And react bindings are included in the standard lib, they also work great. The compiler is fast and produces generally quite reasonable JS.

You could argue that it's not "better" than elm in a theoretical sense. But for practical work it's much closer to the mainstream of web dev in mindset and syntax. Easier to learn, much easier to integrate with other frameworks or into existing teams & codebases. And it's less opinionated about rendering: it generally assumes you're using react, but you don't have to and it can emit anything if you do some extra work wiring it up. I have used it with node and even, irresponsibly, deno fresh.

Been using it whenever I can for frontend stuff for a year now and haven't enjoyed a language this much since... well... elixir.

Re:Elixir – Why the dot (when calling anonymous functions)? by ak_111 on Monday August 14, 2023 @04:00PM (#37126067)
The only popular choices: Typescript, Java, Go (although I don't think it is that popular as a webapp backend language) or C# (I think).
Re:Elixir – Why the dot (when calling anonymous functions)? by weatherlight on Monday August 14, 2023 @04:50PM (#37126642)
Rescript, 100%
Re:Elixir – Why the dot (when calling anonymous functions)? by consilient on Monday August 14, 2023 @06:15PM (#37127463)
Purescript has by far the strongest type system of any mature compile-to-js language, good FFI, footprint comparable to react.

Elm is a heavily stripped down purescript, plus an ambiguously-benevolent dictator for life. Also terrible interop. It's a good learning environment but I would strongly recommend against using it for anything big.

Rescript is basically Ocaml with half-js syntax.

Typescript is bizarre. On a scale from 0 (C) to 10 (Haskell), it's a 12, a 6, and a 2 duct taped together. It's got some incredibly powerful features (template literals, conditional types), but it's missing most of the standard "advanced"-but-production-ready type system features (e.g. no HKTs, no type-directed emit) and the foundation is absolutely riddled with soundness holes.

Re:Elixir – Why the dot (when calling anonymous functions)? by bPspGiJT8Y on Monday August 14, 2023 @06:17PM (#37127479)
Also worth mentioning Idris, although its tooling and ecosystem are still pretty much nonexistent.
Re:Elixir – Why the dot (when calling anonymous functions)? by consilient on Monday August 14, 2023 @06:21PM (#37127510)
Yeah, that's what I meant by "mature". Agda also has a js backend, but neither one can really stand alone. Haskell is closer, but GHCJS is still very much a second class citizen of the ecosystem.
Re:Elixir – Why the dot (when calling anonymous functions)? by bPspGiJT8Y on Monday August 14, 2023 @06:45PM (#37127710)
Clean also has WASM as the compile target via its IR, and its tooling is great. Unfortunately though I couldn't find any sort of a community when I was looking into it, but other than this the language looks quite mature and very industry-oriented. Then there's Lean which also can compile to WASM via some sort of a bridge, it has decent tooling but the ecosystem is still nonexistent.
Re:Elixir – Why the dot (when calling anonymous functions)? by lmm on Monday August 14, 2023 @06:25PM (#37127544)
Few people on the web side know about it but it's secretly Scala.
Re:Elixir – Why the dot (when calling anonymous functions)? by metta2uall on Tuesday August 15, 2023 @12:57AM (#37130356)
F# is also part of the OCaml family, has a great to-JS transpiler (https://fable.io/) and F# code can also be used in .NET projects.