Remix.run Logo
debugnik 4 days ago

> and very much rejects ill-typed programs

No it doesn't. Even on the strictest settings, Typescript is unsound in trivial ways, which I hit every time I use it in anger (e.g. undefined in unassigned variables). And Microsoft libraries seem perfectly ok with asserting their type errors away without any validation, specially for JSON values.

I had a similar experience with Python until I found Pydantic.

I haven't had a chance to try Elixir's new type system (is it ready yet?), but at least their strong-arrow model would ensure that runtime checks for dynamically-typed values are done eventually.

nine_k 4 days ago | parent | next [-]

This is sadly so; TS's type system is unsound. But so is C#'s, in ways much more egregious that in TS. Despite that, both languages are very usable in practice, and their static checks prevent a very wide range of problems common in languages without a static type system.

If you need bulletproof soundness and JS as the runtime, you have Purescript %)

debugnik 4 days ago | parent [-]

> in ways much more egregious that in TS

Which ways you say? As far as I know: both TS and C# can carry hidden nulls; both made the mistake of covariant arrays, but C# actually type checks accesses at runtime; and the other unsound case I know of in C# involves a runtime type check as well. Meanwhile, TS (and Python) allow fully unchecked casts into the wrong type.

> both languages are very usable in practice

Agreed, but I still consider TS too unsound in trivial cases for the claim I replied to, despite its expressive power. I think this industry is lacking severely when it comes to basic software correctness.

pdimitar 2 days ago | parent | prev [-]

> I haven't had a chance to try Elixir's new type system (is it ready yet?)

Sadly no, and it will likely not be fully ready for years still. It's not a funded work and only a few people are working on it (AFAICT) and the core team understandably wants gradual movement and no incompatibilities.

Elixir made me rediscover love for programming and gave me productivity I never dreamed of. But after using it for 9 years, the lack of static typing really started getting on my nerves. There are only so many times you can do manual exhaustive pattern-matching on the hot paths that yell errors in production before you start feeling envious of Rust and Haskell.