top | item 39436607

(no title)

wezm | 2 years ago

> the Gleam aspect of this is inessential, TypeScript is quite good

TypeScript can be quite productive but I find its type system lacking. Specifically the use of structural typing/lack of nominal typing and lack of sum types. I find these extremely useful when writing reliable software, which is why Gleam appeals to me.

discuss

order

Tade0|2 years ago

That's by all design.

Does this prevent you from writing reliable software?

dcre|2 years ago

It has sum types! Type unions with a discriminator.

wezm|2 years ago

It kinda does if https://www.typescriptlang.org/play#example/discriminate-typ... is what you're referring to but it appears to be missing one of the major benefits: an error/warning if you haven't handled all variants.

Edit: lots of replies showing how TypeScript can be made to do exhaustiveness checking. It's neat and all but it's a lot of gymnastics compared to languages that just have this built in, which again is part of the appeal of Gleam for me.