Re: [swift-users] SwiftPM: import ncurses -> conflicting types

2016-12-28 Thread Bouke Haarsma via swift-users
In hindsight it just looks so easy -- I already found those headers in the SDK. Thanks! On 2016-12-29 05:53:22 +, Ankit Aggarwal via swift-users said: ncurses is already present in the macOS sdk, so you don't need to install it via brew. In CNCurses package, create a file called "shim.h"

Re: [swift-users] System Modules and pkgConfig

2016-12-28 Thread Ankit Aggarwal via swift-users
In tls+Swift.h, you already have included the tls.h so you shouldn't need to specify this line `header "/usr/local/opt/libressl/include/tls.h"` at all in the modulemap. > On 29-Dec-2016, at 1:18 AM, Etan Kissling via swift-users > wrote: > > Addition: > > Example system module as I have it n

Re: [swift-users] SwiftPM: import ncurses -> conflicting types

2016-12-28 Thread Ankit Aggarwal via swift-users
ncurses is already present in the macOS sdk, so you don't need to install it via brew. In CNCurses package, create a file called "shim.h": $ cat shim.h #include "ncurses.h" and change the modulemap to this: $ cat module.modulemap module CNCurses [system] { header "shim.h" link "ncurses" e

Re: [swift-users] Using 'SomeProtocol' as a concrete type conforming to protocol 'SomeProtocol' is not supported

2016-12-28 Thread Ray Fix via swift-users
Using Optional, your enum type goes away. (I think it is a great solution unless you need something more than .element and .none in real life.) Great to get all that optional machinery for missing values for free! Then you can constrain elements simply from the Element protocol as in as in:

Re: [swift-users] Using 'SomeProtocol' as a concrete type conforming to protocol 'SomeProtocol' is not supported

2016-12-28 Thread Brandon Knope via swift-users
Aren’t I losing the ability to enforce what is going into this enum’s associated value then? Brandon > On Dec 28, 2016, at 7:05 PM, Nevin Brackett-Rozinsky > wrote: > > It will work if you change the enum declaration to: > > enum ElementNode > > In other words, let the enum hold arbitrary u

Re: [swift-users] Using 'SomeProtocol' as a concrete type conforming to protocol 'SomeProtocol' is not supported

2016-12-28 Thread Nevin Brackett-Rozinsky via swift-users
It will work if you change the enum declaration to: enum ElementNode In other words, let the enum hold arbitrary unconstrained associated types, and then make your APIs utilize instances of the enum with the associated type constrained to a protocol. The specific example you provide is essential

[swift-users] Using 'SomeProtocol' as a concrete type conforming to protocol 'SomeProtocol' is not supported

2016-12-28 Thread Brandon Knope via swift-users
I don’t understand why this is a problem protocol Element { } enum ElementNode { case element(T) case empty } var childElements = [ElementNode]() I need to represent an array of my nodes that could be multiple kinds of elements Is there a workaround? Brandon_

[swift-users] SwiftPM: import ncurses -> conflicting types

2016-12-28 Thread Bouke Haarsma via swift-users
Hi all, I'm trying to build something with ncurses. There's this outdated tutorial: http://dev.iachieved.it/iachievedit/ncurses-with-swift-on-linux/. In order to build, a system module map was provided here: https://github.com/iachievedit/CNCURSES. This assumes `/usr/include/ncurses.h`, whic

Re: [swift-users] System Modules and pkgConfig

2016-12-28 Thread Etan Kissling via swift-users
Addition: Example system module as I have it now: https://github.com/Scriptreactor/SwiftCTLS I'd like to get rid of the absolute path in the module.modulemap's "header" directive and have it instead use pkgConfig values. > On 28 Dec 2016, at 17:12, Etan Kissling via swift-users > wrote: >

Re: [swift-users] Confused/Surprised by IndexingIterator.forEach behavior

2016-12-28 Thread Guillaume Lessard via swift-users
forEach is defined by the Sequence protocol, and is not a mutating function. By definition, it must create a local iterator in order to perform its duty. As a consequence, the variable `stream` is the same immediately before and after the forEach call. Cheers, Guillaume Lessard ___

Re: [swift-users] Confused/Surprised by IndexingIterator.forEach behavior

2016-12-28 Thread Ole Begemann via swift-users
On 28/12/2016 19:57, Travis Griggs via swift-users wrote: The behavior of the following playground snippet surprised me: var source = [10, 20, 30, 40] var stream = source.makeIterator() stream.next() // 10 stream.next() // 20 stream.forEach { (each) in print("\(each)") } // prints 30,

[swift-users] Confused/Surprised by IndexingIterator.forEach behavior

2016-12-28 Thread Travis Griggs via swift-users
The behavior of the following playground snippet surprised me: var source = [10, 20, 30, 40] var stream = source.makeIterator() stream.next() // 10 stream.next() // 20 stream.forEach { (each) in print("\(each)") } // prints 30, 40 to the console stream.next() // 30 stream.next() // 40

[swift-users] System Modules and pkgConfig

2016-12-28 Thread Etan Kissling via swift-users
Hi, before Swift 3, for System Modules to work, these steps were necessary: 1. Creating module map 2. Creating System Module package 3. Creating git repo for System Module package, tagging with version 4. Referencing the System Module package from main package 5. Adding -Xcc -I and -Xlinker -L fla