by johnisgood · 2y ago · 0 comments
Lol this sounds funny, any other compilers that do this? Why does this happen exactly?
> It does not even tell you what part of code it is having issues with so you could change it. You have to comment/uncomment blocks of code to find the problematic part.
Awful.
TypeScript has a notorious "Type instantiation is excessively deep and possibly infinite" warning that can often be unsafely ignored with a `@ts-expect-error` comment
My question stands: why does this happen and how come it is still so primitive that you do not even get to know the location of the issue?
let result: Double = -(1 + 1) + -(1 + 1) - 1
> Swift 6 takes 6.2 seconds to compile this one line. Even toy languages compile equivalent expressions faster.Wild. :P
The link kind of explains why this was a difficult problem, but I think it's worth a moment to consider why this particular difficult problem just wasn't solved. Why was Apple OK with just shrugging, eh, it's hard ?
This is a Quality of Implementation issue. Quality is truly important but because Quality is hard to turn into a metric you'll see management don't like to make it a goal, after all they can't really measure if they succeeded and so when it is competing with other things which are goals it's just abandoned.
Swift's compile time performance is obviously well documented. It's not great, and performance is definitely one of the trade-offs. SwiftUI leans heavily on the compiler and is very much at the sharp end of this. Most "normal Swift" code is by and large just fine. Of course discussions tend to spiral outwards, but stripping context and adding largely uninformed, quick judgements rarely adds value to any discussion.