Instead of Foo[]
the syntactic sugar for Array<Foo>
is now [Foo]
.
[Key:Value]
has now been introduced as syntactic sugar for Dictionary<Key, Value>
The half-closed operator ..
is now ..<
.
...
has stayed the same.
The global sort
function now mutates its first argument.
A new sorted
function returns a new collection.
First lot of changes I had to make to Minilight:
https://github.com/jtauber/minilight-swift/commit/7bc01488197c9ce982c4860b674a3702fa8cbc64
pi
(and presumably maths functions) are no longer available via import Foundation
. Not yet sure where they've moved.
UPDATE: I can just use M_PI
.
This fails in Beta 3:
``` struct Foo {}
struct Bar { var data: [Foo] init() { data = Foo } func test() { data[2] = Foo() } } ```
with
error: '@lvalue $T7' is not identical to 'Foo'
at the data[2] = Foo()
line.
Just to be clear, the following works in the initial release:
struct Foo {}
struct Bar {
var data: Foo[]
init() {
data = Foo[](count: 5, repeatedValue: Foo())
}
func test() {
data[2] = Foo()
}
}
UPDATE: The failure is not because Foo is empty. The following fails:
struct Foo { let i: Int }
struct Bar {
var data: [Foo]
init() {
data = [Foo](count: 5, repeatedValue: Foo(i:2))
}
func test() {
data[2] = Foo(i:2)
}
}
with error: '@lvalue $T8' is not identical to 'Foo'
UPDATE 2: changing Bar
to a class
fixes the issue. Hat tip to Andy Dirnberger for the suggestion.