4 ms·
Yeah. My understanding is the design of type inference is flawed and requires exponential complexity to resolve and it’s not fixable without breaking change. W
by grandempire 2y ago
Yeah. My understanding is the design of type inference is flawed and requires exponential complexity to resolve and it’s not fixable without breaking change.
Why this is not a top priority before literally anything else?
- yAak 2y agoI agree with you, but sounds like a rough problem: https://danielchasehooper.com/posts/why-swift-is-slow/ https://danielchasehooper.com/posts/why-swift-is-slow/
- saagarjha 2y agoThe author is welcome to add type annotations if they want…?
- grandempire 2y ago?? No other language times out error checking. This is insanity.
- saagarjha 2y agoNot regularly but many languages have type systems that are algorithmically worse, like TypeScript
- 9dev 2y agoAs a user, I couldn’t care less about the algorithmic beauty of the type system if it works, lets me type complex things reliably, and is fast enough to stay out of my way. Does it do that by being a mess of duct table and plywood? Totally fine for me.
- saagarjha 2y agoSure, but often the duct tape and plywood makes it difficult to make things that are reliable and stay out of your way.
- troupo 2y agoAnd yet TypeScript doesn't fail with a cryptic nonsensical error just because you have the impossible component with an unfathomable number of two nested lists, like in SwiftUI.
- saagarjha 2y agoAlgorithmically worse doesn't mean worse in practice
- grandempire 2y agoCan you show a common line of type script that will take exponential complexity for typescript to resolve?
- saagarjha 2y agoI think you misunderstood my comment.
- troupo 2y agoEveryone misunderstood your reply. Perhaps it was a pure academic reply? Because reality always trumps theory.
- saagarjha 2y ago> Perhaps it was a pure academic reply Yes, exactly.
- grandempire 2y agoMy understanding is you are saying TypeScript has a similar complexity problem in its type system as Swift. I am wondering if you have a common example that would timeout or have problems. If not then I struggle to see what similarity you are seeing. (Genuine question, I am interested in what other languages do)
- cyberax 2y agoYeah. I have a bunch of code with bog-standard linear algebra classes (vec2, vec3, mat2, ...). No generics, no nothing. Just simple classes with operator overloading. After the recent minor XCode upgrade, Swift can't deduce the type for an expression `((v2 * scalar1) * v3)`, I have to split `let tmp1=v2*scalar1` for it to work. Like, wtf, Apple?
- grandempire 2y agoIt’s even possible to compile on one machine and timeout on another.