Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

this is indeed quite nice, but the difference with Typedefs is that we have real ADT's whereas typescript doesn't.

in theory typedefs should be able to do what spot does, it is just very hard to write formalized code so it will take us a while before we get there



> real ADT's

I always thought these examples were real ADT's:

``` type Bool = true | false;

type Maybe<T> = T | null;

type SumTypeExample = Bool | Maybe<Bool>

interface ProductType1 { b: Bool c: Maybe<Bool> }

interface ProductType2 { s: "a" | "b" | "c" }

interface ProductTypeComposite extends ProductType1, ProductType2 {} ```

Can you explain what's the difference?


> we have real ADT's whereas typescript doesn't.

This sounds interesting. Can you expound a bit more?

This is vague and anecdotal but I find about 80% of what I want to do in TS with types I find very easy to do, 10% I find annoying but possible, and then maybe 10% it just doesn't work.

I'm curious if there's a root cause here.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: