News for hackers. Stuff that matters.
Re:TypeScript 7 by nicoburns on Wednesday July 08, 2026 @04:25PM (#48836994)
Type systems just used to be bad. Anything that forces you to use a class hierarchy to represent an "OR" type (sum types) is painful to work with. Modern languages like TypeScript / Rust / Swift / Kotlin that have sum types are dramatically much nicer.
Re:TypeScript 7 by giraffe_lady on Wednesday July 08, 2026 @09:01PM (#48839598)
Algorithm W is 40 years old and HM has vastly better ergonomics than TS's types.

Why certain approaches didn't catch on until recently, or ever, is an interesting thing to think about but "we didn't know how" is not the story here.

Re:TypeScript 7 by cubefox on Thursday July 09, 2026 @03:27AM (#48842160)
The "or" (and "and") types in TypeScript are set theoretic rather than algebraic, so they don't require wrapping and unwrapping. It seems to me that they are the ones with better ergonomics.
Re:TypeScript 7 by giraffe_lady on Thursday July 09, 2026 @10:07AM (#48846131)
It sounds neat when you phrase it that way but my decade of professional experience in typescript has not shown it to be the case in practice. ymmv I guess.
Re:TypeScript 7 by dboreham on Wednesday July 08, 2026 @11:04PM (#48840477)
C also has sum types.
Re:TypeScript 7 by keyle on Wednesday July 08, 2026 @11:26PM (#48840623)
No if you're referring to unions and an enum, it isn't sum types.