Some small bits and pieces:
Doubleare no longer random access indices. Who was planning on indexing a collection with a
Double, anyway? Just how big was your collection going to be?2
lowercaseStringproperties are gone from
String. I never liked them. Call a function a function, that’s what I say.
quickSortare gone. Generic non-name brand sorts only from now on.
- Instead of having static members for
Boolnow implements the new
CStringis gone. You can still construct strings from c-style strings, but those now take a
ConstUnsafePointer. Probably to discourage people from keeping the nasty little things hanging around in their native primordial form.
- Yet more types are reflectable, and there’s now an enum value to represent Objective-C objects separate from Swift ones.
Now the bigger changes…
ContiguousArrayBuffer are gone. It was kinda surprising they were there in the first place, revealing the inner workings of
Array. Sorry if you spent some time figuring out how to use them, but you probably had no business poking around in there. As a result, the
makeUniqe member functions are also gone.
reverse is no longer lazy. It now gives you back an
Array. Huh. Looks like if you really want to reverse something lazily, you now need to create a
LazyBidirectionalCollection via a call to
lazy(), then call
.reverse() on it to get another lazy collection. Bit cumbersome, but probably more explicit.
lazy() will return the appropriate one from your base collection or sequence. All of them give a base the ability to map and filter, plus conversion to an array. Only the bidirectional and random ones can be reversed, obvs. And the random access one has a subscript. I guess I need to update my article on lazy collections and sequences.
Range is no longer sliceable. I don’t really “get” sliceable, but what I do get suggests
Range shouldn’t have been sliceable.
Speaking of ranges, were you trying to use
Range with floating-point types? Well cut that out and use
StrideThrough instead, both created with a call to
stride (with either a
to or a
through as the second argument name). They mirror respectively a half-open and closed version of
Range. The big difference being if your stride length takes you past the end, they stop striding.
The version of
filter that took a collection not a sequence is gone. It was a bit pointless anyway, since you can’t index randomly into a filtered collection without doing all the filtering up to that point. And the sequence version is no longer lazy, it returns an
Array. If you want to filter lazily, use the explicitly lazy stuff above. If you want to filter starting from the back, you can do
As ever, I refrain from commenting on anything relating to Unicode and Objective-C bridging, for fear of demonstrating my ignorance.