Re: [swift-users] Redeclaration of guard variable is ignored at top-level

2016-06-16 Thread Saagar Jha via swift-users
Looks like a bug…strangely, lldb’s giving number: Int = 5678. On Thu, Jun 16, 2016 at 10:18 PM Martin R via swift-users < swift-users@swift.org> wrote: > Hi, > > I wonder why the Swift compiler does not complain about the > redeclaration of `number` after the guard-statement in top-level code: >

[swift-users] Redeclaration of guard variable is ignored at top-level

2016-06-16 Thread Martin R via swift-users
Hi, I wonder why the Swift compiler does not complain about the redeclaration of `number` after the guard-statement in top-level code: // main.swift import Swift guard let number = Int("1234") else { fatalError() } print(number) // Output: 1234 let number = 5678 print(num

Re: [swift-users] SequenceType vs. CollectionType

2016-06-16 Thread Karl via swift-users
> On 15 Jun 2016, at 01:59, Brent Royal-Gordon via swift-users > wrote: > >> I find the SequenceType protocol a bit confusing. My confusion is best >> explained in the context of a specific, real-world example. Let's say that >> I wanted to extend a protocol with a method "repeated(Int)" th

Re: [swift-users] Feedback for Dependency Injection Framework?

2016-06-16 Thread Ian Terrell via swift-users
Hi Tadeas, I don't generally use the word "dependency" to cover types that are used by another type; those are simply implementation details of the outer type. There is no VC_B until VC_A decides to present one, so I do not it a dependency; there's nothing to inject. The creation and presentation

Re: [swift-users] expression too complex

2016-06-16 Thread Joe Groff via swift-users
> On Jun 16, 2016, at 1:59 PM, davel...@mac.com wrote: > > > Joe, > > I had an expression that worked fine with Swift2.2 but Swift3 (Xcode 8 > version) complains it's too complex: > > The variables are of type CGPoint and the function returns a Bool. > >return (pt.x - p0.x) * (p1.y - p0

Re: [swift-users] expression too complex

2016-06-16 Thread Dave Reed via swift-users
Yes, Erica, your version works. I had just split it up into: let temp1 = (pt.x - p0.x) * (p1.y - p0.y) let temp2 = (pt.y - p0.y) * (p1.x - p0.x) return (temp1 - temp2) < 0.0 which also works. Filed: SR-1794 Is that where I should also file the CGContext endPage() method not working (I

Re: [swift-users] expression too complex

2016-06-16 Thread Erica Sadun via swift-users
func foo () -> Bool { return Double((pt.x - p0.x) * (p1.y - p0.y) - (pt.y - p0.y) * (p1.x - p0.x)) < 0.0 } See if that works and then file a bug report? -- E > On Jun 16, 2016, at 2:59 PM, Dave Reed via swift-users > wrote: > > > Joe, > > I had an expression that worked fine with Swif

Re: [swift-users] Feedback for Dependency Injection Framework?

2016-06-16 Thread Tadeas Kriz via swift-users
Hi Ian, Shouldn't the `ViewController_B` be a dependency and not be instantiated inside a `ViewController_A`? Or ViewControllers/Controllers are not considered dependencies? Thanks, Tadeas On Thu, Jun 16, 2016 at 10:50 PM Ian Terrell via swift-users < swift-users@swift.org> wrote: > Hi Mike, >

Re: [swift-users] expression too complex

2016-06-16 Thread Dave Reed via swift-users
Joe, I had an expression that worked fine with Swift2.2 but Swift3 (Xcode 8 version) complains it's too complex: The variables are of type CGPoint and the function returns a Bool. return (pt.x - p0.x) * (p1.y - p0.y) - (pt.y - p0.y) * (p1.x - p0.x) < 0.0 Thanks, Dave > On Jun 6, 2016,

[swift-users] CGContext endPage method ambiguous (two candidates) Swift 3/Xcode 8

2016-06-16 Thread Dave Reed via swift-users
I've got a project I had been working on using Swift2.2 and decided to migrate to Swift3 (using Xcode 8 beta) before the project gets any bigger. I successfully migrated everything except I have a CGContext for writing to a PDF and calls the endPage() method. For that the compiler responds with

Re: [swift-users] Feedback for Dependency Injection Framework?

2016-06-16 Thread Ian Terrell via swift-users
Hi Mike, Thanks for your response. :) Let me address your points. I apologize for the length; this is a topic I care about and I know my co-workers are reading it. :) I'm going to edit the message history for brevity. My first point of confusion is that these libraries seem to be less about >> d

Re: [swift-users] Feedback for Dependency Injection Framework?

2016-06-16 Thread Mike Lewis via swift-users
Hi Ian, Thanks for your insightful feedback. First, apologies for the broken link in the README. I just updated it (I accidentally linked to the wrong branch). (the actual demo can be found here: https://github.com/square/Cleanse/tree/master/Examples/CleanseGithubBrowser) Anyways, you bring up so

Re: [swift-users] Swift Binary Size vs. Obj-C

2016-06-16 Thread Jens Alfke via swift-users
> On Jun 15, 2016, at 5:02 PM, Austin Zheng via swift-users > wrote: > > Swift binaries are so massive currently because there's no ABI stability, > therefore the runtime and support libraries must be packaged with every > application. This should change in the future. Does anyone have an es

[swift-users] SignedNumberType protocol

2016-06-16 Thread Aaron Bohannon via swift-users
Why doesn't the SignedNumberType protocol include more operators? If a type supports negation, subtraction, and 0, shouldn't we be able to assume that it will support addition, as well? ___ swift-users mailing list swift-users@swift.org https://lists.swi

Re: [swift-users] Trouble with function properties

2016-06-16 Thread Saagar Jha via swift-users
That’s how the Swift interpreter prints out closures. Try let testClosure = {} in the REPL and you’ll get a similar result, except with different arguments and return value due to {} being () -> (). On Wed, Jun 15, 2016 at 8:13 PM Doug Hill via swift-users < swift-users@swift.org> wrote: > Thank

[swift-users] Trouble with function class variables

2016-06-16 Thread Doug Hill via swift-users
I’m just starting to learn Swift and attempting to do some functional-style programming. Specifically I’m learning how to create generic algorithms that can be reused for many different types. What I’m attempting to do is create a new object, passing functions to the initializer. The class would