News for hackers. Stuff that matters.
Re:Mixing Swift and C++ by novok on Sunday July 23, 2023 @03:45PM (#36839013)
If they removed the few small features that are responsible for 80% of the slowness and called it optimized swift I bet many would embrace it fairly quickly, especially considering they are functionally cosmetic features.
Re:Mixing Swift and C++ by math_dandy on Sunday July 23, 2023 @04:22PM (#36839435)
When will “Swift: The Good Parts” be available for preorder?
Re:Mixing Swift and C++ by saagarjha on Sunday July 23, 2023 @05:37PM (#36840121)
Not really. These are pretty critical features for the language.
Re:Mixing Swift and C++ by refulgentis on Sunday July 23, 2023 @06:10PM (#36840393)
Not type inference, rather, whatever is so pathological about the fundamental algorithm for doing Swift type inference that it can become an infinite loop.

This is a Swift-only feature in major languages with type inference.

Re:Mixing Swift and C++ by novok on Monday July 24, 2023 @01:53AM (#36843583)
> Primary-file mode's advantages are that the driver can do incremental compilation by only running frontends for files that it thinks are out of date, as well as running multiple frontend jobs in parallel, making use of multiple cores. Its disadvantage is that each frontend job has to read all the source files in the module before focusing on its primary-files of interest, which means that a portion of the frontend job's work is being done quadratically in the number of jobs. Usually this portion is relatively small and fast, but because it's quadratic, it can easily go wrong. The addition of batch mode was specifically to eliminate this quadratic increase in early work.

One example that would improve the above: replace module imports with file specific imports, including within the module itself. You could also make a case for operator overloading and there are probably a bunch of candidates a swift compiler engineer could tell you that would be small but significant like that.

https://github.com/apple/swift/blob/main/docs/CompilerPerfor...