Re: [swift-users] question about swift and c callbacks

2016-12-30 Thread Michael Gottesman via swift-users
Can you create a quick tarball of the swiftpm project. Would expedite the answering of the question. Michael > On Dec 30, 2016, at 11:17 AM, Yang Yang via swift-users > wrote: > > I try to wrap a c library in swift package named Test. > The code looks like this: > >

Re: [swift-users] Weird protocol behaviour.

2016-12-30 Thread Mikhail Seriukov via swift-users
So as the *foo(_ x:A) *function is generic, when we call *foo(x) *compiler needs to determine what type is *A *to be able to create concrete function. But x defined as *let x = X() as P *so we only know about it that it conforms to *P *but not its real type to put instead of *A*. Right? But where

Re: [swift-users] Weird protocol behaviour.

2016-12-30 Thread Rien via swift-users
> On 30 Dec 2016, at 12:14, Mikhail Seriukov via swift-users > wrote: > > Ok, > But I think I still do not get it. > What does really happen when we write this? >> let x = X() as P >> 'X()' creates a value. 'as P’ constrains the value such that the only things we know

Re: [swift-users] Weird protocol behaviour.

2016-12-30 Thread Mikhail Seriukov via swift-users
Ok, But I think I still do not get it. What does really happen when we write this? let x = X() as P As I said, I expect x to be Any after that. If it is, then it should be ok IMO. But if it is not then what is the actual type of x? So the real question is how the type checker works here?