Re: [swift-users] FileManager.copyItem not throwing?

2017-11-13 Thread Marco S Hyman via swift-users
On 11 Nov 2017, at 01:51, Marco S Hyman via swift-users wrote: > >> My report was closed as a duplicate of 30350792. > > Are you still seeing this on 10.13? I don’t know, let me test... Very good... the copy fails into the catch block as it should using Xcode 9.1 on macOS 10

Re: [swift-users] FileManager.copyItem not throwing?

2017-11-11 Thread Marco S Hyman via swift-users
> On Nov 11, 2017, at 2:07 PM, John Brownie wrote: > > And that's the point. The throw does not happen. An error is logged, but > execution continues as though there was no error. Also... My workaround for this bug assumes you tested for the destination file presence BEFORE doing the copy a

Re: [swift-users] FileManager.copyItem not throwing?

2017-11-10 Thread Marco S Hyman via swift-users
> Running on macOS 10.12.6, Xcode 8.3.2, I get to the copyItem call, which > shows an error on the console: > > 2017-11-11 11:18:25.931446+1000 MyApp[32662:2408351] open on /path/to/file: > Permission denied > > But it doesn't go to either of my catch blocks, but goes to the following > line,

Re: [swift-users] Should Array's `append(_)` function cause `didSet`?

2017-07-07 Thread Marco S Hyman via swift-users
> On Jul 7, 2017, at 9:48 PM, Zhao Xin wrote: > > Thank you very much Marco. But What is “outside of an initializer” really > bothers me. **Both** `func bar(keysAndValues:Dictionary)` > works now. **Are they really outside ?** Uhhh, that is certainly not the results I’d have expected. Perha

Re: [swift-users] Should Array's `append(_)` function cause `didSet`?

2017-07-07 Thread Marco S Hyman via swift-users
> init(keysAndValues:Dictionary) { > self.keys.append(contentsOf: keysAndValues.keys) > } > > Above code doesn't call `didSet` in playground. My .swift file is similar and > didn't call `didSet` either. However, if without a struct, `didSet` is called. “If you don’t need to

Re: [swift-users] Swift Documentation question

2017-07-01 Thread Marco S Hyman via swift-users
> but what I am looking for is something that lists the various protocols and > types that make up the standard library with links to the reference pages for > the types and protocols. Does documentation like this exist? I thought I have > seen this documentation before but for the life of me I

Re: [swift-users] cascaded do/catch bug?

2017-06-29 Thread Marco S Hyman via swift-users
> On Jun 29, 2017, at 4:20 PM, Jordan Rose wrote: > > That does sound like a bug to me. Can you make a self-contained test case and > file at https://bugs.swift.org/ ? Done. SR-5339 Marc ___ swift-users mailing list swift-users@swift.org https://lis

[swift-users] cascaded do/catch bug?

2017-06-29 Thread Marco S Hyman via swift-users
This macOS code in Xcode 8.3.3: if !fileManager.fileExists(atPath: (saveFileURL.path)) { do { 1 ==> try fileManager.linkItem(atPath: url.path, toPath: saveFileURL.path) 2 ==> } catch { // couldn't create hard link, copy file instead do { 3 ==>

Re: [swift-users] FileManager alway returns true in Linux

2017-03-10 Thread Marco S Hyman via swift-users
> On Mar 10, 2017, at 12:32 PM, Proyb P via swift-users > wrote: > > MacOS shown different behavior. Running a playground using Xcode 8.2.1 on macOS 10.12.3 your code returns true and the isDir value is also true. Are you sure the directory “files” exists on your macOS test environment? let

Re: [swift-users] unowned self in closure in a playground

2017-02-21 Thread Marco S Hyman via swift-users
>> > The problem with this solution is that this changes the semantics. I want a > value for every Demo instance. My error... I read too fast and missed the () instantiation of Demo in the failing call. I was reading it as Demo.increment(). Never mind. ___

Re: [swift-users] unowned self in closure in a playground

2017-02-21 Thread Marco S Hyman via swift-users
> The following code crashes: > > class Demo { > var value = 0 > lazy var increment: (Int) -> Void = { [unowned self] by in > self.value += by > print(self.value) > } > } > > Demo().increment(3) > error: Playground execution aborted: error: Execution was interrupted, > reason: EXC

Re: [swift-users] for with optional collection?

2017-02-09 Thread Marco S Hyman via swift-users
> On Feb 9, 2017, at 1:26 PM, Rick Mann via swift-users > wrote: > > Is there any concise way to write the following? > > if let collection = someOptionalCollection > { >for item in collection >{ >} > } someOptionalCollection?.map { /* do something with $0 /* } _

Re: [swift-users] Bool to Int

2016-11-21 Thread Marco S Hyman via swift-users
> Except it does, because if I write > > let a = 2 > a is of type Int (at least, according to Xcode's code completion). and if you write let b = 2 + 0.5 2 is treated as a double. The type of the literal “2” varies with context. Do you also find that inconsistent and confusing?

Re: [swift-users] Bool to Int

2016-11-20 Thread Marco S Hyman via swift-users
> Is there a way that avoids branching? Don’t know. Have you profiled let r = a > b ? 1 : 0 to know it is an issue? > > So, according to Xcode, "true" and "a > b" both have type "Bool". I don't > know why the compiler allows one and not the other, except that it's literal, > and I guess ther

Re: [swift-users] Localization in Swift.

2016-11-02 Thread Marco S Hyman via swift-users
On Nov 1, 2016, at 11:42 PM, Zhao Xin via swift-users wrote: > > I have already give a workable implementation above. Your implementation assume \(x) is always %@x. What does it do when given -- to use an example from the swift book: "\(multiplier) times 2.5 is \(Double(multiplier) * 2.5)”

Re: [swift-users] Performance critical code in Swift

2016-10-02 Thread Marco S Hyman via swift-users
> > On a broader note, I have yet to see a true modern replacement for SQLite on > the embedded side. There are any number of lightweight document stores, but > they either have performance worse than SQLite, or are not really suitable > for embedded use. Realm ??? It’s faster than sqlite and

Re: [swift-users] private vs. fileprivate on global declaration in Swift3?

2016-09-28 Thread Marco S Hyman via swift-users
> On Sep 28, 2016, at 8:04 AM, Jens Alfke via swift-users > wrote: > > >> On Sep 28, 2016, at 12:16 AM, Cao Jiannan via swift-users >> wrote: >> >> I think the Swift team should tell us which is better. > > If one were better than the other, they wouldn’t both exist... > > It depends on w

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

2016-09-21 Thread Marco S Hyman via swift-users
> On Sep 21, 2016, at 2:22 PM, Jens Persson via swift-users > wrote: > > // This little Swift program compiles (and runs) fine: > > func foo() -> Int { return a } > let a = 1 > let b = 2 > print(foo()) > > But if `foo()` returns `b` instead of `a`, I get this compile time error: > "Use of unr

Re: [swift-users] Swift and Xcode along with Playgrounds is full of bugs

2016-09-13 Thread Marco S Hyman via swift-users
On Sep 13, 2016, at 6:53 PM, Shyamal Chandra via swift-users wrote: > > I am not arguing; I am bringing up defect in the Apple way of handling bugs > for Swift, Xcode, and Playgrounds. Am I supposed to wait for eternity? As Jens noted, you have to separate Swift from Xcode and Playgrounds.

Re: [swift-users] Migrating to Swift 3 using Xcode fails

2016-09-08 Thread Marco S Hyman via swift-users
> 6. It’s still using the old compiler and my code fails to build. Select your target. Click on the Build Settings Tab. Scroll down to the Swift Compiler - Version group and change Use Legacy Swift Language Version from Yes to No. I haven’t a clue if that will actually work. It’s worth a t

Re: [swift-users] See documentation comment for discussion

2016-06-19 Thread Marco S Hyman via swift-users
> On Jun 19, 2016, at 6:35 PM, Maury Markowitz via swift-users > wrote: > > All true, except, of course, when one is working with strings that really do > work perfectly weel qwith 1...2, like the strings I'm processing, which came > from 80-column punch cards originally used with LLNL's CDC

Re: [swift-users] Static linking

2016-06-18 Thread Marco S Hyman via swift-users
> On Jun 18, 2016, at 2:55 PM, Rod Brown via swift-users > wrote: > > From what I understand, these dylibs are very light Not always so light as earlier discussed on this list. An Xcode 8 Swift 3 compile shows swift Frameworks taking 9.2 MB of the 11.5 MB total app size for an OS X app I’

Re: [swift-users] #selector with Swift 3?

2016-06-17 Thread Marco S Hyman via swift-users
> On Fri, Jun 17, 2016 at 9:33 PM, Maury Markowitz via swift-users > wrote: > I was asked to try out the latest betas of Cocoa to check if a SceneKit bug I > reported has been fixed. As part of this I decided to try an update to Swift > 3. I've run into a number of minor issues, but one has me

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

2016-06-15 Thread Marco S Hyman via swift-users
On Jun 15, 2016, at 5:37 PM, Seth Friedman via swift-users wrote: > > Does anyone know if the runtime libs definitively increased in size in Swift > 3? I could have sworn I heard 4.5 MB for Swift 2. The total of the Frameworks dir in a Swift 2.2 app I have is 5.8M. The breakdown for this app

[swift-users] Amusing function return warning in swift 3

2016-06-12 Thread Marco S Hyman via swift-users
My first try with 5/31 swift 3 snapshot gave me a warning regarding an unused return value -- in main.swift. Wouldn’t you know, NS ApplicationMain is declared as func NSApplicationMain(_ argc: Int32, _ argv: UnsafeMutablePointer?>) -> Int32 And what does the second line of function help s

Re: [swift-users] Dictionary with optional values

2016-05-18 Thread Marco S Hyman via swift-users
> On May 18, 2016, at 11:03 AM, Artyom Goncharov via swift-users > wrote: > > Yes, of course I can use API method but this kind of behaviour for subscript > operator seems inconsistent(or even magical) to me because it is possible to > initialise a dictionary with nil without casting it. Thou

Re: [swift-users] Wrapping function declarations in #if swift()

2016-05-12 Thread Marco S Hyman via swift-users
On May 12, 2016, at 10:38 PM, Tyler Fleming Cloutier via swift-users wrote: > > Hello everyone, > > It does seem like it is currently possible to wrap just the function > declaration in an #if swift() directive like so: > > #if swift(>=3.0) > public func add(filter filterName: String, path: S

Re: [swift-users] Swift 3.0

2016-04-17 Thread Marco S Hyman via swift-users
On Apr 17, 2016, at 12:36 PM, Dennis Weissmann wrote: > > Thanks Brent! Ditto. It got me to the next step, anyway. I suspect I’m going to have to add @objc(...) for each of the delegate functions, etc. Marc ___ swift-users mailing list swift-users

Re: [swift-users] Swift 3.0

2016-04-17 Thread Marco S Hyman via swift-users
Hey Marc, > > You didn’t explicitly state the problem you’re running into but I assume you > can’t build the app. The app builds fine. Running the app gives me errors such as "Must implement numberOfRowsInTableView: and tableView:objectValueForTableColumn:row:” when the swiftified version "n

[swift-users] Swift 3.0

2016-04-17 Thread Marco S Hyman via swift-users
Is this the appropriate list to ask questions regarding the 3.0 snapshots? I’ve hand converted a small OS X app such that it compiles using the 2016-04-12 snapshot to get a feel for the changes. Now I’m trying to get it to run. Marc ___ swift-users ma