want to understand type inference? options: 1. read pages of incomprehensible alchemy that doesn't even define it's notation! https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system … 2. here's a blog post about implementing it in python. https://eli.thegreenplace.net/2018/type-inference/ …
-
-
Replying to @dominictarr
I actually was thinking I'd "just" read the TypeScript spec, since it has some of the best inference I've seen.
1 reply 1 retweet 1 like -
Replying to @wmhilton
what things do you think it's better than, specifically?
1 reply 0 retweets 0 likes -
Replying to @dominictarr
I have a sneaking suspicion that it's using something more than plain old hindley milner, so I'm just very curious how it works.
1 reply 0 retweets 0 likes -
Replying to @wmhilton @dominictarr
And I haven't seen anywhere that *names* the algorithm TS uses, so I started reading the specs. I'm only on page 3 though.
1 reply 0 retweets 0 likes -
-
Replying to @wmhilton
Well, I know you can have "or" types in ts but I don't think in haskell you can have a if where then and else get different types? HM is just unification... but TS has different base rules, I bet, because JS you can do operations across multiple types? stuff like that
1 reply 0 retweets 0 likes -
Replying to @dominictarr
Yeah, stuff like that. Type "narrowing" in conditional branches, functions with "asserts" clauses ... there's a lot of control flow logic tied into the type system, and I've always wondered how they do that under the hood.
1 reply 0 retweets 1 like -
Replying to @wmhilton @dominictarr
But I read somewhere the type checker itself is a single 30,000 line JavaScript file, so I figure reading the source might not be the best way to learn about it.
3 replies 0 retweets 1 like -
Replying to @wmhilton @dominictarr
Perhaps read
@orta's notes on the TypeScript compiler to begin with?https://github.com/orta/typescript-notes …3 replies 0 retweets 1 like
He linked to this within the issues of the repository which was interesting to watch:https://youtu.be/wSdV1M7n4gQ
-
-
I also have a WIP playground plugin which shows the associated flow nodes for a particular identifier - though it’s definitely a dev tool and not polished https://github.com/orta/playground-code-show-flow …pic.twitter.com/NjN8VfNYI3
1 reply 0 retweets 2 likes -
this guy tried, and I think it's nice. Good formatting on the fancy stuff. http://reasonableapproximation.net/2019/05/05/hindley-milner.html …
0 replies 0 retweets 1 like
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
