[swift-users] Using String

2018-01-10 Thread Michael Ilseman via swift-users
Hello, I just sent an email to swift-dev titled "State of String: ABI, Performance, Ergonomics, and You!” at https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20180108/006407.html, whose gist can be found at https://gist.github.com/milseman/bb39ef7f170641ae52c13600a512782f

Re: [swift-users] Start another program from Swift script

2018-01-04 Thread Michael Ilseman via swift-users
The “Shell Out” package’s source code shows some simple usage of Foundation’s Process: https://github.com/JohnSundell/ShellOut/blob/master/Sources/ShellOut.swift#L33. That package also handles stdout / stdin, but for more sophisticated uses of FileManager the “Files” package’s source has some

Re: [swift-users] UnsafeMutableRawPointer to UnsafeMutablePointer: EXC_BAD_ACCESS on pointee

2017-09-23 Thread Michael Ilseman via swift-users
> On Sep 23, 2017, at 3:44 AM, nyg nyg via swift-users > wrote: > > Hello all, > > I'm trying to get an UnsafeMutablePointer from an > UnsafeMutableRawPointer obtained using the Unmanaged structure: > > class C { var foo = 42, bar = "bar" } > let c = C() > > let

Re: [swift-users] Should I be using more catchless do blocks?

2017-06-19 Thread Michael Ilseman via swift-users
> On Jun 19, 2017, at 11:47 AM, Michael Savich wrote: > > Yeah, it's all about balance to be sure. Though one benefit of do blocks is > in functions that are tied to a sense of time. It seems to me that the in > case of something like viewDidLoad separating code into

Re: [swift-users] Should I be using more catchless do blocks?

2017-06-19 Thread Michael Ilseman via swift-users
Introducing scope to manage lifetimes of local variables is a useful and valuable practice. Note that it might also be an opportunity to refactor the code. Any do block you want to introduce could also be a local function definition that you call later. Alternatively, it could be generalized

Re: [swift-users] Importing C system libraries

2017-03-28 Thread Michael Ilseman via swift-users
This is into uncharted territory for me, but it seems you’re building with SwiftPM. You’ll probably want to configure extra compiler flags if that’s possible. You could also bite the bullet and build your C libraries with SwiftPM as well. Hopefully someone on swift-build-dev can help you out.

Re: [swift-users] Asynchronous error recovering with RecoverableError

2017-03-28 Thread Michael Ilseman via swift-users
New start task: https://bugs.swift.org/browse/SR-4405 Add @escaping to RecoverableError.attemptRecovery > On Mar 28, 2017, at 3:31 PM, Douglas Gregor wrote: > > >> On Mar 28, 2017, at 11:21 AM, Michael Ilseman

Re: [swift-users] Asynchronous error recovering with RecoverableError

2017-03-28 Thread Michael Ilseman via swift-users
CC Doug Gregor, who git blame tells me wrote this part. Doug, this slightly predates noescape-by-default. Is this a bug or as intended? > On Mar 28, 2017, at 8:49 AM, Elia Cereda via swift-users > wrote: > > Hi Dennis, > > Thanks for your answer. I can see that my

Re: [swift-users] Importing C system libraries

2017-03-28 Thread Michael Ilseman via swift-users
Sure! In this example, I have built libgit2. I have a directory called Git, and inside that I have the following module map: module Git [system] { header "/libgit2/include/git2.h" export * } When I run, I use: swift -I -L -lgit2 foo.swift inside

Re: [swift-users] Importing C system libraries

2017-03-27 Thread Michael Ilseman via swift-users
I feel being left behind as an Xcode user... > > Jan > >> On 27 Mar 2017, at 22:59, Michael Ilseman via swift-users >> <swift-users@swift.org> wrote: >> >> Sure. At a low level, you can create a module.map file and use -L/-l flags >> in y

Re: [swift-users] Importing C system libraries

2017-03-27 Thread Michael Ilseman via swift-users
Sure. At a low level, you can create a module.map file and use -L/-l flags in your invocation of Swift. If you want to do so at a higher level, then perhaps SwiftPM can. CCing swift-build-dev for the SwiftPM part. > On Mar 26, 2017, at 3:20 PM, Kelvin Ma via swift-users >

Re: [swift-users] Airbnb's Swift 3 Migration Blog

2017-02-07 Thread Michael Ilseman via swift-users
> On Feb 7, 2017, at 4:58 PM, Chengyin Liu wrote: > > Thanks for the feedback! > > > This is probably source-compatibility that you want, not necessarily ABI > > compatibility. > > You are right. Thank you for the correction. > > > BTW, are you mixed-source? If so,

Re: [swift-users] Airbnb's Swift 3 Migration Blog

2017-02-07 Thread Michael Ilseman via swift-users
Comments: > Since the Swift ABI changed between versions 2 and 3, even correct Swift 3 > code that imports Swift 2 libraries will not compile. This incompatibility > made it difficult to parallelize code conversion. This is probably source-compatibility that you want, not necessarily ABI

Re: [swift-users] FUSE module for swift

2017-01-06 Thread Michael Ilseman via swift-users
To pass in the option to Clang, use -Xcc instead of -Xswiftc, like: swift test -Xswiftc -DFUSE_USE_VERSION=25 -Xcc -D_FILE_OFFSET_BITS=64 As far as in the module map file, I don’t know if that’s supported[1]. You might be able to make your own header that defines it before including fuse.h,

Re: [swift-users] Updating C-wrapper to Swift 3

2016-09-28 Thread Michael Ilseman via swift-users
> On Sep 28, 2016, at 10:03 AM, John Brownie via swift-users > wrote: > > Thanks for the pointers. Good reading, but I'm still confused. I think that > the first issue is clear to me now, but I don't know what I have to do to > make the closure be seen as satisfying

Re: [swift-users] @escaping may only be applied to parameters of function type

2016-09-14 Thread Michael Ilseman via swift-users
> On Sep 13, 2016, at 8:16 PM, Michael Ilseman via swift-users > <swift-users@swift.org> wrote: > > >> On Sep 13, 2016, at 8:14 PM, Rick Mann <rm...@latencyzero.com> wrote: >> >> But the Apple declaration (accessible via Xcode) of the method it's base

Re: [swift-users] @escaping may only be applied to parameters of function type

2016-09-14 Thread Michael Ilseman via swift-users
> On Sep 13, 2016, at 8:37 PM, Shawn Erickson wrote: > > I am in the process of updating to Xcode 8 release so I can't confirm at the > moment but I am fairly sure I hit a situation with being asked to implement a > func from a protocol that got autocompleted with @escape

Re: [swift-users] @escaping may only be applied to parameters of function type

2016-09-13 Thread Michael Ilseman via swift-users
> On Sep 13, 2016, at 8:14 PM, Rick Mann wrote: > > But the Apple declaration (accessible via Xcode) of the method it's based on > looks like this: > > open func enumerator(at url: URL, >includingPropertiesForKeys keys: [URLResourceKey]?, >options mask:

Re: [swift-users] @escaping may only be applied to parameters of function type

2016-09-13 Thread Michael Ilseman via swift-users
TL;DR: The optional is already escaping, due to the fact that “T?" is sugar for Optional, and the noescape-by-default rule only applies to types in immediate parameter position. Current Swift master has much better diagnostics for this case. There is not currently a general solution involving

Re: [swift-users] Swift 3 (Xcode 8 GM) issue with @escaping

2016-09-08 Thread Michael Ilseman via swift-users
> On Sep 7, 2016, at 6:50 PM, Jacob Bandes-Storch <jtban...@gmail.com> wrote: > > On Wed, Sep 7, 2016 at 5:54 PM, Michael Ilseman via swift-users > <swift-users@swift.org <mailto:swift-users@swift.org>> wrote: > I implemented a better (i.e. correct) diagno

Re: [swift-users] Swift 3 (Xcode 8 GM) issue with @escaping

2016-09-07 Thread Michael Ilseman via swift-users
I implemented a better (i.e. correct) diagnostic message for this at https://github.com/apple/swift/pull/4670. I want to also do a better diagnostic specifically for aggregate parameters to functions (e.g. optional closures), but that requires more work in the type checker. Basically,

Re: [swift-users] Generate Swift interface from Objective-C file using clang

2016-07-06 Thread Michael Ilseman via swift-users
The best way I know of is the swift-ide-test tool, and you’ll see it being invoked by many of the ClangImporter tests. > On Jul 6, 2016, at 10:45 AM, Ryan Wilson via swift-users > wrote: > > Hi everyone, > > In Xcode, I can generate a Swift interface for an Objective-C

Re: [swift-users] An OpenGL math library in pure Swift

2016-01-05 Thread Michael Ilseman via swift-users
> On Jan 4, 2016, at 7:11 PM, David Turnbull via swift-users > wrote: > > I've been working on a math library for SwiftGL. It's looking good. Vector2, > Vector3, Vector4, Matrix2x2, Matrix3x3, Matrix4x4 are implemented with all > arithmetic. You can even swizzle just