Files
swift-mirror/www/FAQ.rst
Dave Abrahams 30d9e8821f *.rst: Use litre.TestsAreMissing exceptions
to avoid long processing times and reams of error messages for as-yet-untested files

Swift SVN r4508
2013-03-28 13:45:11 +00:00

58 lines
2.5 KiB
ReStructuredText

.. @raise litre.TestsAreMissing
.. _FAQ:
Frequently Asked Questions about Swift
======================================
Obviously many more questions can be added.
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.
Won't the design and evolution of Swift be warped by being too C++-centric?
---------------------------------------------------------------------------
This is a common question from Objective-C programmers, primarily those who
really dislike C++. There are a lot of reasons you can have hope that Swift
will end up being a great "successor to Objective-C instead of a "C++
replacement":
* The compiler team has expert-level knowledge of Objective-C (the language),
having implemented the compiler for it from the ground-up. We probably know
its dark corners better than anyone.
* The Swift team has broad experience with a number of other programming
languages, including C/C++/Objective-C, Python, Haskell, Java, Javascript,
C#, ...
* We know C++ well enough to not want to repeat its mistakes.
It turns out that there are a lot of reasons to dislike C++, and those people
who spend a lot of time writing C++ code are some of the most expert people at
explaining its varied faults. Don't consider use of C++ to be the same as
"love" for it. :)