The performance regression that occurred when ++ and -- were added as
requirements to the Index protocols was due to the fact that it caused a
dubious hack of mine to be bypassed: when treated as indices, integer
types are incremented and decremented without overflow checking. While
technically justifiable (see the r20576 commit message), this makes the
standard library extremely fragile and makes successor() and
predecessor() mathematically unsafe. We really should see what the
optimizer team can do to make that hack unnecessary.
In the meantime, instead of dispatching through ++ and --, use a
special, defaulted _[successor|predecessor]InPlace() method to give
indices their own, customizable in-place inc/dec-rement path.
Swift SVN r26926
* Use "reflecting:" rather than "reflect:" as an argument label. It
reads more sensibly.
* Unify toString()/toDebugString() with other reflection APIs by converting
them into String initalizers, and by renaming Printable/DebugPrintable to
CustomStringConvertible and CustomDebugStringConvertible.
* Drop "make" prefix from "makeCustomMirror" and
"makeCustomPlaygroundQuickLook". It is not, as we had thought,
mandated by Cocoa naming guidelines.
Swift SVN r26918
Rename 'assignment' attribute of infix operators to 'mutating'. Add
'has_assignment' attribute, which results in an implicit declaration of
the assignment version of the same operator. Parse "func =foo"
declaration and "foo.=bar" expression. Validate some basic properties of
in-place methods.
Not yet implemented: automatic generation of wrapper for =foo() if foo()
is implemented, or vice versa; likewise for operators.
Swift SVN r26508
This changes 'if let' conditions to take general refutable patterns, instead of
taking a irrefutable pattern and implicitly matching against an optional.
Where before you might have written:
if let x = foo() {
you now need to write:
if let x? = foo() {
The upshot of this is that you can write anything in an 'if let' that you can
write in a 'case let' in a switch statement, which is pretty general.
To aid with migration, this special cases certain really common patterns like
the above (and any other irrefutable cases, like "if let (a,b) = foo()", and
tells you where to insert the ?. It also special cases type annotations like
"if let x : AnyObject = " since they are no longer allowed.
For transitional purposes, I have intentionally downgraded the most common
diagnostic into a warning instead of an error. This means that you'll get:
t.swift:26:10: warning: condition requires a refutable pattern match; did you mean to match an optional?
if let a = f() {
^
?
I think this is important to stage in, because this is a pretty significant
source breaking change and not everyone internally may want to deal with it
at the same time. I filed 20166013 to remember to upgrade this to an error.
In addition to being a nice user feature, this is a nice cleanup of the guts
of the compiler, since it eliminates the "isConditional()" bit from
PatternBindingDecl, along with the special case logic in the compiler to handle
it (which variously added and removed Optional around these things).
Swift SVN r26150
The standard library has grown significantly, and we need a new
directory structure that clearly reflects the role of the APIs, and
allows future growth.
See stdlib/{public,internal,private}/README.txt for more information.
Swift SVN r25876