Re: [swift-users] Swift 3 likes to tease me

2016-09-22 Thread Adam Eberbach via swift-users
Xcode will be happy if you add “@objc” in front of your “func” declaration. > On 23 Sep 2016, at 2:51 PM, Gerriet M. Denkmann via swift-users > wrote: > > This line (Swift 3): > if a.responds(to: Selector(“viewControllers") ) > creates this warning: Use

[swift-users] Swift 3 likes to tease me

2016-09-22 Thread Gerriet M. Denkmann via swift-users
This line (Swift 3): if a.responds(to: Selector(“viewControllers") ) creates this warning: Use '#selector' instead of explicitly constructing a 'Selector' Ok. Following this advice I change it to: if a.responds(to: #selector(“viewControllers")) and now get an error instead:

Re: [swift-users] NSData vs Data write to string differently?

2016-09-22 Thread Martin R via swift-users
I had filed a related bug https://bugs.swift.org/browse/SR-2514 Add a "hex dump" method to `Data` as a result of the discussion starting at https://lists.swift.org/pipermail/swift-users/Week-of-Mon-20160822/003035.html Martin > On 23 Sep 2016, at 03:47, Joe Groff via swift-users

Re: [swift-users] NSData vs Data write to string differently?

2016-09-22 Thread Joe Groff via swift-users
> On Sep 22, 2016, at 4:04 PM, Shawn Erickson via swift-users > wrote: > > In general you shouldn't depend on what description returns for classes, etc. > outside of your control unless it is documented (e.g. part of the API > contract). If you want a specific output

Re: [swift-users] NSData vs Data write to string differently?

2016-09-22 Thread Shawn Erickson via swift-users
In general you shouldn't depend on what description returns for classes, etc. outside of your control unless it is documented (e.g. part of the API contract). If you want a specific output you should code up something to format the output as you need. -Shawn On Thu, Sep 22, 2016 at 3:33 PM

[swift-users] NSData vs Data write to string differently?

2016-09-22 Thread Robert Nikander via swift-users
Hi, I’ve run into a problem when updating to new Swift in Xcode 8. There was some NSData in a string like this: “ … \(data) … “ It changed to type `Data`, and the string went from hexadecimal bytes to writing “20 bytes”. I’m doing a quick bug fix app release now. I can’t remember if

Re: [swift-users] Encoding an array of tuples with a NSCoder

2016-09-22 Thread Saagar Jha via swift-users
This used to work in a previous beta of Xcode 8 (beta 4, I think…I haven't checked in the meantime due to issues with Swift 3 migration). I'm guessing it got changed with the Any/AnyObject work going on in between. I'll go with using a 2-element array in the meantime. On Thu, Sep 22, 2016 at 14:27

[swift-users] Encoding an array of tuples with a NSCoder

2016-09-22 Thread Saagar Jha via swift-users
Hello, I’ve been working on migrating some old code over to Swift 3, and I’m having some trouble archiving an array of tuples: class Foo: NSObject, NSCoding { var bar: [(string1: String, string2: String)] required init?(coder aDecoder: NSCoder) { bar =

Re: [swift-users] Status of building Swift 3.0 on RHEL variants

2016-09-22 Thread Ron Olson via swift-users
Yes, I have the 3.0-RELEASE version, from source, running perfectly on a Fedora 24 instance. I started with https://github.com/corinnekrych/swift-rpm, but it's a bit out of date and I had to clone it and update the script and spec with some changes; there are still a couple of manual steps

[swift-users] Status of building Swift 3.0 on RHEL variants

2016-09-22 Thread Lane Schwartz via swift-users
Hi, I was wondering if anyone has successfully build Swift 3.0 from source on RHEL, whether there are any gotchas I should know about before I give it a try. If found this ( http://stackoverflow.com/questions/34073701/install-swift-language-on-centos-red-hat), which indicated that at that time

Re: [swift-users] Can anyone please explain this behavior?

2016-09-22 Thread Jens Persson via swift-users
Ah, yes. Thanks. On Thu, Sep 22, 2016 at 8:29 PM, Joe Groff wrote: > > > On Sep 22, 2016, at 11:28 AM, Jens Persson wrote: > > > > Yes, but should the compiler silently accept that? And is this issue > really related to the other issue? > > No, this is a

Re: [swift-users] Can anyone please explain this behavior?

2016-09-22 Thread Joe Groff via swift-users
> On Sep 22, 2016, at 11:28 AM, Jens Persson wrote: > > Yes, but should the compiler silently accept that? And is this issue really > related to the other issue? No, this is a separate issue. The compiler might be able to catch some obvious cases, but it'd be impossible to

Re: [swift-users] Can anyone please explain this behavior?

2016-09-22 Thread Joe Groff via swift-users
> On Sep 22, 2016, at 11:23 AM, Jens Persson wrote: > > Oh, but how can the following (earlier mentioned) example have anything to do > with Script-mode top-level locals being treated as globals? > > Create "AnotherFile.swift" containing: > func f() -> Int { return a } >

Re: [swift-users] Can anyone please explain this behavior?

2016-09-22 Thread Jens Persson via swift-users
Oh, but how can the following (earlier mentioned) example have anything to do with Script-mode top-level locals being treated as globals? Create "AnotherFile.swift" containing: func f() -> Int { return a } let a = f() Create "main.swift" containing: print(a) Compile. Run. For ever. At zero %

Re: [swift-users] Can anyone please explain this behavior?

2016-09-22 Thread Jens Persson via swift-users
Thank you for the thorough explanation! /Jens On Thu, Sep 22, 2016 at 7:28 PM, Jordan Rose wrote: > Yep, it really is a long-standing bug. Script-mode top-level locals are > treated as globals (module-scope bindings) by the compiler, but their > initial bindings are

Re: [swift-users] Ubuntu 16.04 support?

2016-09-22 Thread Lane Schwartz via swift-users
Will the Ubuntu 14.04 package remain available? On Wed, Sep 21, 2016 at 3:16 PM, Todd Fiala via swift-users < swift-users@swift.org> wrote: > Hey that’d be great. Thanks, Mishal! > > -Todd > > On Sep 21, 2016, at 9:42 AM, Mishal Shah wrote: > > I should have Ubuntu 16.04

Re: [swift-users] Ubuntu 16.04 support?

2016-09-22 Thread Todd Fiala via swift-users
Hey that’d be great. Thanks, Mishal! -Todd > On Sep 21, 2016, at 9:42 AM, Mishal Shah wrote: > > I should have Ubuntu 16.04 system available on ci.swift.org > by end of day. > > Thanks, > Mishal Shah > > On Sep 21, 2016, at 9:25 AM, Todd Fiala

Re: [swift-users] Something you might be able to answer

2016-09-22 Thread Philippe Hausler via swift-users
So there are a couple of ways objects can be bridged: 1) has-a style bridges - RunLoop and CFRunLoop for example. The only association is where RunLoop contains a CFRunLoop and there is a method to fetch the CFRunLoop out of the RunLoop. Some times this relationship is not public. 2) is-a

Re: [swift-users] Ubuntu 16.04 support?

2016-09-22 Thread Todd Fiala via swift-users
Hmm, likes get a JIRA tracking this if we don’t have one already. Mishal, what’s the current ETA on the Ubuntu 16.04 switch-over? -Todd > On Sep 21, 2016, at 9:11 AM, Michael Gottesman wrote: > > +CC Todd. > >> On Sep 20, 2016, at 9:25 PM, Ron Olson via swift-users >>

Re: [swift-users] Can anyone please explain this behavior?

2016-09-22 Thread Jens Persson via swift-users
Did you see the other code examples that came up in that twitter conversations? For example: This worrying little program compiles: func f() -> Int { return a } let a = f() It also compiles if you print(a) at the end, and it will print 0. If we replace Int with [Int] it will still compile