3 ms·
Lattner directly addresses this in a FAQ in the repository[1] "Do you plan to rewrite the Swift compiler in Swift? Not in the short term. C++ is a very pragmat
by oflannabhra 11y ago
Lattner directly addresses this in a FAQ in the repository[1]
"Do you plan to rewrite the Swift compiler in Swift?
Not in the short term. C++ is a very pragmatic language for implementing compilers, since it has good performance characteristics and allows higher-level programming idioms than C.
That said, we do expect Swift to a better language than C++ in a number of ways, so why don't we implement the compiler itself in Swift? There are a couple of reasons that bootstrapping is not a good idea, at least in the short term:
This complicates bringup of the compiler, because you have to move both the compiled language and the compiler at the same time as the language evolves.
We want the language evolution and direction to be driven by general purpose programming challenges, not by the specific needs of compiler hackers. The urge to "scratch our own itch" might be too great.
That said, we are writing the runtime library in Swift itself. We may also decide to rewrite the compiler in Swift sometime in the distant future when the language settles down. At that point, it may be a good opportunity to revisit previous (internal to the compiler) design decisions, and we do expect and hope Swift to be a great language for doing many things, including implementing compilers."
1. https://github.com/apple/swift/blob/master/www/FAQ.rst https://github.com/apple/swift/blob/master/www/FAQ.rst