Re: [swift-users] Trying to learn swift 3 renamification (as mattn calls it!)

2016-04-21 Thread Neil Faiman via swift-users
> On Apr 21, 2016, at 5:50 PM, Charles Lane via swift-users > wrote: > > Xcode wants to insert a comma between the words ‘with rect:’ for some reason. Is that a two-word parameter “name”, or is it just a parameter with an external name “with” and an internal name “rect”? Neil Faiman

Re: [swift-users] Trying to learn swift 3 renamification (as mattn calls it!)

2016-04-21 Thread Neil Faiman via swift-users
> On Apr 21, 2016, at 6:42 PM, Erica Sadun wrote: > > >> On Apr 21, 2016, at 4:37 PM, Neil Faiman via swift-users >> wrote: >> >> >>> On Apr 21, 2016, at 5:50 PM, Charles Lane via swift-users >>> wrote: >>> >>>

[swift-users] Range subscript is ambiguous

2016-05-15 Thread Neil Faiman via swift-users
This function seems simple enough: func foo(a: [Int], n: Int) { var x : [Int] = a[0..' var x : [Int] = a[0..) -> ArraySlice { get set } ^ Swift.MutableCollectionType:3:12: note: found this candidate public subscript (bounds: Range) -> MutableSlice { get set } ^

[swift-users] Conditional generic initializers?

2016-05-15 Thread Neil Faiman via swift-users
Is it possible for a generic class to have methods (specifically, initializers) which are only defined if the generic parameters meet certain constratins? Here’s a concrete example: class Foo { init(pairs: [(T1, T2)]) {} // What I’d like to be able to doL convenience

Re: [swift-users] Conditional generic initializers?

2016-05-15 Thread Neil Faiman via swift-users
ay 15, 2016, at 1:33 PM, Karl wrote: > > Yes. You need to put it in an extension. > > extension Foo where T1 == T2 { >convenience init(values: [T1]){ >…. > } > } > >> On 15 May 2016, at 14:45, Neil Faiman via swift-users >> wrote: >>

[swift-users] Initializer inheritance doesn't work with generic class?

2016-05-15 Thread Neil Faiman via swift-users
This compiles fine: class Sup { init(supDes: Int) {} convenience init(supCon: Int) { self.init(supDes: supCon) } } class Sub : Sup { convenience init(subCon1: Int) { self.init(supDes: subCon1) } convenience init(subCon2: Int) { self.init(supCon: subCon2

Re: [swift-users] Initializer inheritance doesn't work with generic class?

2016-05-15 Thread Neil Faiman via swift-users
Here is another, more blatant example of the failure to inherit initializers from a generic base class: class Concrete { init(value: Int) {} } class ConcreteSub : Concrete { } class Generic { init(value: T) {} } class GenericSub : Generic { }

[swift-users] Member wise initializer doesn't work with default-initialized const properties

2016-05-16 Thread Neil Faiman via swift-users
Using the default Swift with Xcode 7.3.1. It appears that you cannot use the implicit memberwise initializer with a struct that has “let” properties with default values. This works perfectly: struct CF { let prop: Int } let cf = CF(prop: 1) But give the property a default v

Re: [swift-users] Member wise initializer doesn't work with default-initialized const properties

2016-05-18 Thread Neil Faiman via swift-users
> On May 17, 2016, at 7:03 AM, Jeremy Pereira > wrote: > > >> On 16 May 2016, at 22:37, Neil Faiman via swift-users >> wrote: >> >> Using the default Swift with Xcode 7.3.1. >> >> It appears that you cannot use the implicit memberwise initial

[swift-users] Expression pattern cannot be a named tuple constant

2016-06-11 Thread Neil Faiman via swift-users
Swift 2.2 in Xcode 7.3.1. Apparently you cannot use a named tuple constant as an expression pattern in a case label. func test(x: Int, y: Int) -> Int { let int_1 = 1 switch x { case 0: return 0 case int_1: return 1 default: break } let int_1_1

Re: [swift-users] Why this can't compile

2016-06-29 Thread Neil Faiman via swift-users
> On Jun 29, 2016, at 11:03 PM, boris via swift-users > wrote: > > //Report Error: Ambiguous reference to member ‘map’ > // > numbers.map({ > (number: Int) in > var ret = 3 * number > return ret > }) I asked the same question a few months ago; the answer was that it is

[swift-users] Expression pattern cannot be a named tuple constant

2016-07-04 Thread Neil Faiman via swift-users
(Resending — this didn’t get any responses when I sent it a month ago.) Swift 2.2 in Xcode 7.3.1. Apparently you cannot use a named tuple constant as an expression pattern in a case label. func test(x: Int, y: Int) -> Int { let int_1 = 1 switch x { case 0: return 0 case int_1

Re: [swift-users] Expression pattern cannot be a named tuple constant

2016-07-05 Thread Neil Faiman via swift-users
SR-1993. > On Jul 5, 2016, at 4:15 PM, Jordan Rose wrote: > > I'd definitely consider that a bug. Can you file it at bugs.swift.org? > > Jordan > >> On Jul 4, 2016, at 14:56, Neil Faiman via swift-users >> wrote: >> >> (Resending — this didn

Re: [swift-users] another issue with tuples

2016-07-06 Thread Neil Faiman via swift-users
The language reference says that “Assignment is performed from each part of the value to the corresponding part of the expression. A String value can be assigned to a String, and a () -> Int value can be assigned to a () throws -> Int, so one would reasonably expect that both tuple assignments w

Re: [swift-users] Expression pattern cannot be a named tuple constant

2016-07-06 Thread Neil Faiman via swift-users
be conflating a tuple-type with tuple-pattern… > > Shane > > >> On Jul 5, 2016, at 6:16 PM, Neil Faiman via swift-users >> wrote: >> >> SR-1993. >> >>> On Jul 5, 2016, at 4:15 PM, Jordan Rose wrote: >>> >>> I'd defini

Re: [swift-users] pattern matching in if improvement?

2016-03-26 Thread Neil Faiman via swift-users
> On Mar 26, 2016, at 5:47 PM, Maury Markowitz via swift-users > wrote: > > Before I stick my head into the other list, consider: > > if statusCode >= 200 && statusCode <= 299 > > I'm sure examples of something like this occur throughout your code. But the > actual semantics of the test is