Re: [swift-users] Reducing the boilerplate for my ID types

2016-05-17 Thread Brent Royal-Gordon via swift-users
> I have some ID types that are simple ints coming back from a database. I > wanted to improve type safety so I don’t accidentally assign product IDs to > user IDs, etc. I want to be able to print it and use it as a dictionary key. > So it is a trivial wrapper of Int. E.g. > > struct

Re: [swift-users] function advancedBy() bugs

2016-05-17 Thread zh ao via swift-users
I just make a clearer example. do { var str = "abcdefg" var str1 = str + "hijklmn" var range = str.startIndex.. wrote: > On Tue, May 17, 2016 at 5:46 AM, zh ao via swift-users > wrote: > > It seams that I encountered bugs in function advancedBy(). > > > >

[swift-users] Reducing the boilerplate for my ID types

2016-05-17 Thread Ray Fix via swift-users
Hello, I have some ID types that are simple ints coming back from a database. I wanted to improve type safety so I don’t accidentally assign product IDs to user IDs, etc. I want to be able to print it and use it as a dictionary key. So it is a trivial wrapper of Int. E.g. struct

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

2016-05-17 Thread Matthew Johnson via swift-users
Sent from my iPad > On May 17, 2016, at 11:42 AM, Jeremy Pereira via swift-users > wrote: > > >> On 17 May 2016, at 15:48, Neil Faiman wrote: >> >> On May 17, 2016, at 7:03 AM, Jeremy Pereira >> wrote: >> >>>

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

2016-05-17 Thread Jeremy Pereira via swift-users
> On 17 May 2016, at 15:48, Neil Faiman wrote: > > 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

Re: [swift-users] function advancedBy() bugs

2016-05-17 Thread Dmitri Gribenko via swift-users
On Tue, May 17, 2016 at 5:46 AM, zh ao via swift-users wrote: > It seams that I encountered bugs in function advancedBy(). > > do { > var str = "abcdefg" > var range = str.startIndex.. str += "hijklmn" > range.endIndex = str.endIndex // 0..<14 > let

Re: [swift-users] function advancedBy() bugs

2016-05-17 Thread zh ao via swift-users
The second half on mutating is wrong. Please ignore that. Zhaoxin On Tue, May 17, 2016 at 8:47 PM, zh ao wrote: > Xcode Version 7.3.1 (7D1014), swift 2.2 along with Xcode. > > Zhaoxin > > On Tue, May 17, 2016 at 8:46 PM, zh ao wrote: > >> It seams that I

Re: [swift-users] function advancedBy() bugs

2016-05-17 Thread zh ao via swift-users
Xcode Version 7.3.1 (7D1014), swift 2.2 along with Xcode. Zhaoxin On Tue, May 17, 2016 at 8:46 PM, zh ao wrote: > It seams that I encountered bugs in function advancedBy(). > > //: Playground - noun: a place where people can play > > > import Foundation > > > do { > > var

[swift-users] function advancedBy() bugs

2016-05-17 Thread zh ao via swift-users
It seams that I encountered bugs in function advancedBy(). //: Playground - noun: a place where people can play import Foundation do { var str = "abcdefg" var range = str.startIndex.. Self @warn_unused_result public func advancedBy(n: Self.Distance, limit: Self) -> Self }

Re: [swift-users] super.init() called automatically?

2016-05-17 Thread James Campbell via swift-users
Not a big fan of this implict behaviour. Not super obvious. *___* *James⎥Head of Trolls* *ja...@supmenow.com ⎥supmenow.com * *Sup* *Runway East * *10 Finsbury Square* *London* * EC2A 1AF * On 17 May 2016 at 10:48,

Re: [swift-users] super.init() called automatically?

2016-05-17 Thread tuuranton--- via swift-users
Why is this the intentional behavior? Seems a bit strange that init() is a special exception to the rule. 16. May 2016 19:29 by clatt...@apple.com: > > >> On May 16, 2016, at 7:09 AM, tuuranton--- via swift-users <>> >> swift-users@swift.org>> > wrote: >> >> Why does the following