Re: [swift-users] NSMutableData's init?(length length: Int) initializer

2016-04-14 Thread Dmitri Gribenko via swift-users
On Thu, Apr 14, 2016 at 11:16 PM, Chris Lattner via swift-users wrote: > >> On Apr 14, 2016, at 10:45 AM, soyer via swift-users >> wrote: >> >> Hello Guys, Girls, >> >> Do you know why is the init?(length length: Int) NSMutableData's initializer >> failable? >> The memory allocation can fail, b

Re: [swift-users] NSMutableData's init?(length length: Int) initializer

2016-04-14 Thread Chris Lattner via swift-users
> On Apr 14, 2016, at 10:45 AM, soyer via swift-users > wrote: > > Hello Guys, Girls, > > Do you know why is the init?(length length: Int) NSMutableData's initializer > failable? > The memory allocation can fail, but I think Swift doesn't handle that cases. > (it is not a real issue in a mod

[swift-users] Help need with SR-1187

2016-04-14 Thread Jose Cheyo Jimenez via swift-users
Hi Everybody, I am trying to build the example-packages but I am getting errors once I try to run test I was hopping to add some tests to close https://bugs.swift.org/browse/SR-1187 I am using the 3-24 snapshot but I am getting import errors : error:

Re: [swift-users] NSMutableData's init?(length length: Int) initializer

2016-04-14 Thread Jacob Bandes-Storch via swift-users
It's easy to test this in a playground on OS X: NSMutableData(length: 1000) // returns nil It makes sense that the swift-corelibs-foundation version of NSMutableData should work the same way. Jacob On Thu, Apr 14, 2016 at 11:56 AM, Jens Alfke via swift-users < swift-users@swift

Re: [swift-users] Can't extend a generic type with a non-protocol constraint?

2016-04-14 Thread David Sweeris via swift-users
You know… if protocols could define which types can implement them, that could be made to be the same thing: protocol _String {…} `syntax which restricts instances of _String to be a` String extension Dictionary where Key: _String {…} //Same as "where Key == String”, because that’s the o

Re: [swift-users] Can't extend a generic type with a non-protocol constraint?

2016-04-14 Thread Brent Royal-Gordon via swift-users
> It appears that you can’t extend a generic class/struct with a requirement > that a type parameter inherit from a non-protocol: > extension Dictionary where Key : String { … } > The above produces the error “Type ‘Key’ constrained to non-protocol type > ‘String’”. You can't do `Key: Stri

[swift-users] Can't extend a generic type with a non-protocol constraint?

2016-04-14 Thread Jens Alfke via swift-users
It appears that you can’t extend a generic class/struct with a requirement that a type parameter inherit from a non-protocol: extension Dictionary where Key : String { … } The above produces the error “Type ‘Key’ constrained to non-protocol type ‘String’”. So is there a way I can add a m

Re: [swift-users] NSMutableData's init?(length length: Int) initializer

2016-04-14 Thread Jens Alfke via swift-users
> On Apr 14, 2016, at 10:45 AM, soyer via swift-users > wrote: > > Do you know why is the init?(length length: Int) NSMutableData's initializer > failable? Because the Objective-C declaration in declares the return type as ‘nullable’: - (nullable instancetype)initWithLength:(NSUInteger)len

[swift-users] NSMutableData's init?(length length: Int) initializer

2016-04-14 Thread soyer via swift-users
Hello Guys, Girls, Do you know why is the init?(length length: Int) NSMutableData's initializer failable? The memory allocation can fail, but I think Swift doesn't handle that cases. (it is not a real issue in a modern OS) The code on github calls a non failable initializer. https://github.com/a

Re: [swift-users] Assigning [Int] to [Any] crashes Swift 2.2

2016-04-14 Thread Joe Groff via swift-users
> On Apr 14, 2016, at 9:24 AM, Jens Alfke wrote: > > >> On Apr 14, 2016, at 9:00 AM, Joe Groff wrote: >> >> This is a known bug. Converting arrays of value type to arrays of protocol >> type is not supported—only class covariance is supported with containers—but >> the compiler fails to cat

Re: [swift-users] Use Package Manager for iOS Development

2016-04-14 Thread Ryan Lovelett via swift-users
On Thu, Apr 14, 2016, at 07:54 AM, Marco Betschart via swift-users wrote: > > Dear Swift Users, > I’d like to use the Swift Package Manager for my dependency management > - regardless of it’s early stage: > Something like having the Swift Package Manager doing all the > dependency management work f

[swift-users] Use Package Manager for iOS Development

2016-04-14 Thread Marco Betschart via swift-users
Dear Swift Users, I’d like to use the Swift Package Manager for my dependency management - regardless of it’s early stage: Something like having the Swift Package Manager doing all the dependency management work from terminal and using the current Xcode stable release for building an iOS App S

Re: [swift-users] Assigning [Int] to [Any] crashes Swift 2.2

2016-04-14 Thread Jens Alfke via swift-users
> On Apr 14, 2016, at 9:00 AM, Joe Groff wrote: > > This is a known bug. Converting arrays of value type to arrays of protocol > type is not supported—only class covariance is supported with containers—but > the compiler fails to catch some cases. Thanks for the info! I found that if I use

Re: [swift-users] Assigning [Int] to [Any] crashes Swift 2.2

2016-04-14 Thread Joe Groff via swift-users
> On Apr 13, 2016, at 9:09 PM, Jens Alfke via swift-users > wrote: > > Just ran into a weird crash with Swift 2.2 in Xcode 7.3. It reproduces in a > playground: > > import Foundation > let a = [88] > let b: [Any] = a // CRASH > > In my real program, the top of the crash backtrace is: > >