Re: [swift-users] Incorrect Fisher-Yates shuffle in example code

2017-12-16 Thread Daniel Dunbar via swift-users
Would you like to post a PR to fix these issues? - Daniel > On Dec 16, 2017, at 4:34 PM, Nevin Brackett-Rozinsky via swift-users > wrote: > > The example implementation of the Fisher-Yates shuffle found here >

Re: [swift-users] module.modulemap documentation

2017-12-04 Thread Daniel Dunbar via swift-users
That is correct. If you have a suggestion for places you looked in the docs and a reference or explanation would have been good, feel free to open a PR for it! - Daniel > On Dec 3, 2017, at 7:56 PM, Frank Swarbrick wrote: > > Well no wonder I couldn’t find it. So this

Re: [swift-users] module.modulemap documentation

2017-12-03 Thread Daniel Dunbar via swift-users
> On Dec 3, 2017, at 7:42 PM, Frank Swarbrick via swift-users > wrote: > > Where are all of the options/parameters/behaviors/whatever documented? I > can’t for the life of me find it anywhere. GINMF. https://clang.llvm.org/docs/Modules.html - Daniel > > Frank >

Re: [swift-users] Cancelling an SPM build cleanly

2017-11-07 Thread Daniel Dunbar via swift-users
> On Nov 7, 2017, at 10:25 AM, Geordie J wrote: > > I was just reminded of this issue by another thread (thanks Daniel Dunbar for > https://github.com/apple/swift-llbuild/pull/196 > !) > > Is it possible to cancel an SPM

Re: [swift-users] xcode 9 new build system too aggressive?

2017-11-07 Thread Daniel Dunbar via swift-users
> On Nov 7, 2017, at 10:18 AM, David Baraff wrote: > > Ah. i hadn’t thought about the fact that often-time my first attempt to > build fails. that might well be the deciding thing. > any idea how long before this will show up in a release xcode? weeks? > months? a

Re: [swift-users] xcode 9 new build system too aggressive?

2017-11-07 Thread Daniel Dunbar via swift-users
This does sound like a serious bug (and may be one I just fixed https://github.com/apple/swift-llbuild/pull/196), but if its specific to an Apple product please report bugs in Xcode on http://bugreporter.apple.com - Daniel > On Nov 6, 2017, at 10:11 PM, David Baraff via swift-users >

Re: [swift-users] Communicating with dynamically loaded swift library

2017-10-07 Thread Daniel Dunbar via swift-users
Is it possible for you to make a small test package that shows the problem, and file a bug in bugs.swift.org? There may be something we need to fix in SwiftPM before this can work (because of our linking model). - Daniel > On Oct 7, 2017, at 10:42 PM, Ján Kosa via swift-users

Re: [swift-users] Communicating with dynamically loaded swift library

2017-10-04 Thread Daniel Dunbar via swift-users
The way that I have done this in the past is pass a protocol as an unsafe pointer to an exposed entry point: ```swift let entryPoint = dlsym(handle, “initializePlugin”) guard entryPoint != nil else { fatalError("missing plugin entry point: \(pluginPath)")

Re: [swift-users] Package Manager test target name conflict

2017-07-29 Thread Daniel Dunbar via swift-users
Since we don’t have any name spacing facility yet, I think the right answer here is for packages to always give their tests a name like Tests. Even though we might conceptually be able to allow a few limited areas of collision, it gets cumbersome when we might offer features like “run all tests

Re: [swift-users] Is there any harm that an @escaping handler never called?

2017-07-11 Thread Daniel Dunbar via swift-users
> On Jul 11, 2017, at 3:55 PM, Zhao Xin via swift-users > wrote: > > For example, I have an async query, I pass it an `@escaping resultHandler`. > If there is any results, the handler will run. However, if the result is > empty, the

Re: [swift-users] Passing Data to a f(void *) function

2017-06-30 Thread Daniel Dunbar via swift-users
> On Jun 30, 2017, at 7:40 AM, Martin R via swift-users > wrote: > > I have a C function > >void myfunc(const void *ptr); > > which is imported to Swift as > >func myfunc(_ ptr: UnsafeRawPointer!) > > This compiles and runs without problems: > >let data

Re: [swift-users] swift 4 compiler error tuple parameter does not support destructing

2017-06-29 Thread Daniel Dunbar via swift-users
This is due to SE-0110: https://github.com/apple/swift-evolution/blob/master/proposals/0110-distingish-single-tuple-arg.md but see the additional commentary: https://lists.swift.org/pipermail/swift-evolution-announce/2017-June/000386.html For now you can rewrite it as: ``` let

Re: [swift-users] arc4random_uniform on Linux is missing from Foundation??

2017-05-22 Thread Daniel Dunbar via swift-users
This function isn't something which comes with Foundation, it is supplied by the BSD libraries on Darwin, but those aren't present on Linux. I recommend looking for a Swift implementation of a high-quality RNG which will meet your needs, rather than trying to rely on a non-portable

Re: [swift-users] passing command line arguments to `swift test`

2017-05-21 Thread Daniel Dunbar via swift-users
To run one test you can use: swift test -s BasicTests.PathTests/testContains See: swift test --help - Daniel > On May 19, 2017, at 4:34 PM, Kelvin Ma via swift-users > wrote: > > i want to be able to run a single test case at a time instead of my whole > test

Re: [swift-users] Annotating C APIs without changing the original header files

2017-05-12 Thread Daniel Dunbar via swift-users
We don't have explicit support for api notes in SwiftPM. We discussed it, and it something which probably makes sense, but no one has worked on a design or implementation yet. - Daniel > On May 12, 2017, at 11:32 AM, Michael Gottesman via swift-users > wrote: > >

Re: [swift-users] Passing value types or members of value types?

2017-05-06 Thread Daniel Dunbar via swift-users
> On May 6, 2017, at 10:27 PM, Nate Birkholz via swift-users > wrote: > > Classes and structs are different things. Classes are passed by reference, > structs are passed by value with copy on write. This is not correct. Array, and other types, implement copy-on-write

Re: [swift-users] error: the package has an unsupported layout, unexpected source file(s) found: /Users/maximveksler/Project/Org/Collection/Sources/main.swift

2017-01-24 Thread Daniel Dunbar via swift-users
> On Jan 24, 2017, at 11:57 AM, Maxim Veksler via swift-users > wrote: > > The most recent change I've done is add the Sources/extensions/Jay.swift, now > I'm unable to build the project. > > No idea what could have gone wrong, feedback? > > > ➜ Collection

Re: [swift-users] Announcement: Official Docker Image for Swift now available

2017-01-21 Thread Daniel Dunbar via swift-users
Awesome, thanks for pushing this forward! - Daniel > On Jan 21, 2017, at 2:10 PM, Swizzlr via swift-users > wrote: > > Hello all, > > I'm pleased to announce that with the assistance of many, many people (see > below), we have released an “official" Docker image for

Re: [swift-users] Exclamation mark's in swift parameter listings?

2017-01-09 Thread Daniel Dunbar via swift-users
It is an "implicitly unwrapped optional", or IOU. See: https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html - Daniel > On Jan 9, 2017, at 4:23 PM, Ethin Probst via swift-users > wrote: > > Hello all, >

Re: [swift-users] [swift-build-dev] SwiftPM Test Fixtures

2016-11-18 Thread Daniel Dunbar via swift-users
The way that we have been doing this is by using `#file` to derive the location of the test data. It is gross, but it works until we have a real resource story. - Daniel > On Nov 17, 2016, at 7:07 PM, Ryan Lovelett via swift-build-dev > wrote: > > If I have a

Re: [swift-users] Using Swift Package Manager with C++

2016-11-12 Thread Daniel Dunbar via swift-users
This was just fixed on trunk: https://bugs.swift.org/browse/SR-3152?jql=text%20~%20%22C%2B%2B%22%20ORDER%20BY%20created%20DESC In the meantime, you can either use a recent snapshot from swift.org, or you can pass `-Xlinker -lc++` on the command line to work around the problem. - Daniel >

Re: [swift-users] swift3 - Trying to get swift package example to work - Stack Overflow

2016-11-11 Thread Daniel Dunbar via swift-users
Hey Dave, Thanks for pointing this out, we will take a look. - Daniel > On Nov 11, 2016, at 3:35 PM, Dave Yost via swift-users > wrote: > > >> http://stackoverflow.com/questions/40557767/trying-to-get-swift-package-example-to-work >> >>

Re: [swift-users] How to include swift test resource files?

2016-11-10 Thread Daniel Dunbar via swift-users
We do not yet have any kind of story for resources. If you just need data during tests, what you can do is just rely on the tests being run in an environment which has access to the source, so you can use Swift's `#file` to derive the location of your test artifacts from the current source

Re: [swift-users] Monorepo workflow using SPM

2016-11-09 Thread Daniel Dunbar via swift-users
> On Nov 3, 2016, at 2:06 PM, Erica Sadun via swift-users > wrote: > > I want less of a monorepo than an ability to build a group of orthogonal > elements into a single repo so I don't have to create a separate repo for > every single Swift library I build, especially

Re: [swift-users] Monorepo workflow using SPM

2016-11-09 Thread Daniel Dunbar via swift-users
(+ swift-build-dev) Hi Georgios, This is a very timely question, because I have been working on a proposal for solving exactly this problem. Can you take a look at: https://github.com/ddunbar/swift-evolution/blob/multi-package-repos/proposals/-swiftpm-multi-package-repos.md and see if

Re: [swift-users] Swift Package Manager and Git submodules

2016-10-30 Thread Daniel Dunbar via swift-users
> On Oct 29, 2016, at 7:22 AM, Anton Bronnikov wrote: > > Thanks, Daniel. > > Yes, on Oct-27 snapshot `Swift version 3.0-dev (LLVM b52fce3ab4, Clang > 4edf31e82f, Swift bf2de4a41c)` if I build with `swift build > --enable-new-resolver` then I do get the expected

Re: [swift-users] Swift Package Manager and Git submodules

2016-10-28 Thread Daniel Dunbar via swift-users
This sounds like a bug to me, I suspect that the current code isn't causing the submodule to update appropriately. If you have a working example, can you try using the latest OSS snapshot from swift.org, and running: swift package reset swift build --enable-new-resolver and seeing if you

Re: [swift-users] how to ``swift build`` C library cleanly without using -Xcc -Xlinker and -Xswiftc

2016-10-20 Thread Daniel Dunbar via swift-users
> On Oct 20, 2016, at 7:25 AM, Martin Man via swift-users > wrote: > > Hi guys, > > I’m wrapping three little native C libraries using SPM to a nice swifty > modules. Say cmod1, cmod2, and cmod3. They all in the and are dependencies of > a bigger project. > > Since

Re: [swift-users] Swift Package Manager questions

2016-10-17 Thread Daniel Dunbar via swift-users
Hi Ed, No, the package manager in the Xcode 8.1 beta only has minimal bug fixes. You can, however, get this by grabbing a snapshot toolchain from http://swift.org/download. - Daniel > On Oct 17, 2016, at 12:10 PM, Edward Connell via swift-users > wrote: > > Thanks

Re: [swift-users] Counting in Threads

2016-10-12 Thread Daniel Dunbar via swift-users
unsafe in a threaded context. > > Sent from my iPhone > > On Oct 12, 2016, at 8:18 AM, Daniel Dunbar via swift-users > <swift-users@swift.org <mailto:swift-users@swift.org>> wrote: > >> I suspect one of the actual compiler people might tell me I shouldn't

Re: [swift-users] Counting in Threads

2016-10-12 Thread Daniel Dunbar via swift-users
I suspect one of the actual compiler people might tell me I shouldn't trust this, but in practice it works: -- import Darwin.C public class AtomicInt32 { public fileprivate (set) var value : Int32 = 0 /// Create a new atomic integer with the specified initial value. public

Re: [swift-users] Swift Package Manager (SPM) Deployment Target

2016-09-26 Thread Daniel Dunbar via swift-users
There isn't yet a builtin way to manage this. When generating an Xcode project, you can use the undocumented `--xcconfig-overrides` option to pass a path to an extra .xcconfig file you wish to include in the project and have build settings read from. You could then override the deployment

Re: [swift-users] Stored Property on Protocol Extension

2016-09-12 Thread Daniel Dunbar via swift-users
> On Sep 11, 2016, at 6:12 PM, Tanner Nelson via swift-users > wrote: > > Hey Swift Users, > > I was wondering how you all work around not being able to add stored > properties in extensions (especially protocol extensions). > > I ran into an issue recently where I

Re: [swift-users] Statically linked binaries on linux

2016-09-01 Thread Daniel Dunbar via swift-users
We don't currently build static versions of the other libraries (Foundation, XCTest), or a support process for picking them up. This is covered by: https://bugs.swift.org/browse/SR-648 As you note, it largely works for Swift-only, so this is feasible but we need someone to drive it. Are you

Re: [swift-users] Updating the swift.org examples

2016-08-18 Thread Daniel Dunbar via swift-users
Hi Joel, Thank you for pointing this out! > On Aug 18, 2016, at 3:14 AM, Joel Hughes via swift-users > wrote: > > Morning all, > > I've just upgraded to Swift 3 Preview 6 for Ubuntu and have noticed a few > changes. > > First using XCTest: "the name of a test module

Re: [swift-users] repo questions when using example-package-dealer

2016-06-30 Thread Daniel Dunbar via swift-users
I wouldn't say they are "unclean", but they have not been retagged after the latest commits to them, and you are right they probably should be. Feel free to file a bug on this at http://bugs.swift.org . - Daniel > On Jun 29, 2016, at 11:25 PM, Dave Yost

Re: [swift-users] repo questions when using example-package-dealer

2016-06-29 Thread Daniel Dunbar via swift-users
FYI, some of our planned workflow improvements here are covered by: https://github.com/apple/swift-evolution/blob/master/proposals/0082-swiftpm-package-edit.md - Daniel > On Jun 29, 2016, at 7:11

Re: [swift-users] Clarification on the role of `CustomStringConvertible`

2016-06-29 Thread Daniel Dunbar via swift-users
gt; wrote: > >> >> On Jun 29, 2016, at 3:51 PM, Erica Sadun <er...@ericasadun.com> wrote: >> >> On Jun 29, 2016, at 2:33 PM, Daniel Dunbar via swift-users >> <swift-users@swift.org> wrote: >>> >>> I would like some clarification regar

[swift-users] Clarification on the role of `CustomStringConvertible`

2016-06-29 Thread Daniel Dunbar via swift-users
I would like some clarification regarding the expected role of `CustomStringConvertible` for types which have a natural, lossless, string representation. I don't have good terminology to use here, but is the expectation that the "textual string representation" is a readable description of the

Re: [swift-users] New Swift Snapshots Available!

2016-06-21 Thread Daniel Dunbar via swift-users
Can you reduce the problem to a small test case? Please file a bug report on bugs.swift.org for this, and include information on the last toolchain which worked. - Daniel > On Jun 21, 2016, at 5:16 AM, Charles Lane via swift-users > wrote: >

Re: [swift-users] SPM - point dependcies to branches

2016-06-20 Thread Daniel Dunbar via swift-users
As you have noticed, we don't have support for this yet. Most requests of this nature are currently in our bug tracker, for example: https://bugs.swift.org/browse/SR-666 - Daniel > On Jun 20, 2016, at 6:14 AM, Anindha Parthy via swift-users > wrote: > > Hi, > > I

Re: [swift-users] String initializers and developer ergonomics

2016-05-09 Thread Daniel Dunbar via swift-users
> On May 9, 2016, at 10:28 AM, Jacob Bandes-Storch via swift-users > wrote: > > On Mon, May 9, 2016 at 10:25 AM, Joe Groff via swift-users > > wrote: > > > On May 7, 2016, at 10:39 AM, Austin Zheng via swift-users >

Re: [swift-users] make swift compiler to use the precompiled module files

2016-04-29 Thread Daniel Dunbar via swift-users
Clang will cache these automatically, can you give more details on exactly what you are seeing? - Daniel > On Apr 28, 2016, at 10:50 PM, Ramakrishna Mallireddy via swift-users > wrote: > > I have these precompiled module files generated every-time I run the swift >

Re: [swift-users] build swift-package-manager-0.1 Linux Swift 2.2

2016-04-07 Thread Daniel Dunbar via swift-users
+Lang `swift build` currently uses the Swift interpreter to get the Package metadata from the Package.swift. That in turn uses the LLVM JIT. It may be that some of what Swift is using is not implemented in the JIT for this platform. This is worth filing a bug on http://bugs.swift.org, if you

Re: [swift-users] swift build

2016-04-03 Thread Daniel Dunbar via swift-users
If you build swift yourself you need to point directly at swift-build. Most people grab the pre-built toolchains from swift.org to start trying things out. Have you seen the instructions here: https://swift.org/download/#using-downloads - Daniel > On Apr 3, 2016, at 7:27 PM, Shawn Erickson

Re: [swift-users] Sporadically undefined symbols during linking

2016-04-02 Thread Daniel Dunbar via swift-users
Are you saying that it fails about 75% of the time even when building from clean, or it fails overall 75% of the time and you have to build from clean to fix? In my experiments it always fails when building just ostrichframework. My guess is that if you build in the IDE you are seeing it

Re: [swift-users] Serious Issue with Project Preprocessor Build Setting, Xcode 7.3 and Swift.

2016-03-24 Thread Daniel Dunbar via swift-users
(+Jordan) Jordan, did something change here? Were we previously getting these via the Clang importer in a way we aren't anymore? - Daniel > On Mar 24, 2016, at 9:02 AM, James Campbell wrote: > > I've just attached one now. The preprocessor macro is specified in the build

Re: [swift-users] Serious Issue with Project Preprocessor Build Setting, Xcode 7.3 and Swift.

2016-03-24 Thread Daniel Dunbar via swift-users
Swift has never supported referring directly to macros, it only supports "build configurations". I'm still not sure exactly what you have that could have worked previously. Can you please attach a complete project showing something which worked in 7.2 and does not work now to the bug you

Re: [swift-users] Swift Package Manager: Linker Flags

2016-01-04 Thread Daniel Dunbar via swift-users
You can't do this via the package manager, but you can include "link" declarations in the module map itself which specify additional linker arguments to plumb through when that module is used. See: http://clang.llvm.org/docs/Modules.html#link-declaration Here is a concrete example, which is

Re: [swift-users] How to define interdependent modules in a package?

2015-12-24 Thread Daniel Dunbar via swift-users
What we hope to do here eventually is have swiftpm "notice" when a build has failed because of a missing dependency, and then automatically help you update the manifest to include it. This allows the dependency specifications to continue to be explicit, which some people believe is important

Re: [swift-users] Linux: module for needs -fblocks to compile

2015-12-20 Thread Daniel Dunbar via swift-users
> On Dec 17, 2015, at 1:40 PM, Tom Sheffler via swift-users > wrote: > > I’m learning about Swift on Linux and using modules to wrap C libraries. One > of the things I wanted to do was use libdispatch with blocks from Swift. I > thought it would be easy to use a

Re: [swift-users] Using Swift for interpreted shell scripts?

2015-12-16 Thread Daniel Dunbar via swift-users
> On Dec 16, 2015, at 7:21 AM, @lbutlr via swift-users > wrote: > > On 15 Dec 2015, at 14:12, John Regner wrote: >> Check out this talk from Ayaka on just this topic! >> https://realm.io/news/swift-scripting/ > > Thank you, that looks very

Re: [swift-users] memory requirements for building swift on linux?

2015-12-14 Thread Daniel Dunbar via swift-users
For those hitting this issue, you might try building without debug info to see if that helps (build-script -R). - Daniel > On Dec 14, 2015, at 6:55 AM, Kevin Lundberg via swift-users > wrote: > > I was able to build it on my 8GB macbook successfully, but there may be

Re: [swift-users] Instantiate Swift class from string

2015-12-10 Thread Daniel Dunbar via swift-users
> On Dec 10, 2015, at 1:01 PM, Matthew Davies via swift-users > wrote: > > Yes I have the protoco​l​, but the problem is that I would want to be able to > call a method on the class that isn't necessarily defined in the protocol. You should only call methods that are

Re: [swift-users] Segfault importing sqlite3.h from a system module

2015-12-05 Thread Daniel Dunbar via swift-users
> On Dec 5, 2015, at 4:29 AM, Michael Buhot wrote: > > Hello, > > I’m getting a segfault when importing sqlite using a swift system module and > the package manager. > I have the following directory structure with a trivial system module and > application: > > CSqlite3/ >

Re: [swift-users] "swift build" throws :0: error: no such file or directory: 'build'

2015-12-05 Thread Daniel Dunbar via swift-users
Sounds like you don't have the Swift package's usr/bin in your path, and are using an old `swift` without this support. See full instructions at: https://swift.org/download/#apple-platforms - Daniel > On Dec 5, 2015, at 2:06 PM, Joy Mailer via swift-users > wrote: >