[swift-users] skriva ut

2016-12-30 Thread Jens Persson via swift-users
prislappar-österbybruk2017.pdf Description: Adobe PDF document österbybruks bibliotek 2017 jan-feb.pdf Description: Adobe PDF document ___ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users

Re: [swift-users] skriva ut

2016-12-30 Thread Jens Persson via swift-users
Oops, autocompletion-mistake, sorry about that, please ignore ... On Fri, Dec 30, 2016 at 9:43 AM, Jens Persson wrote: > > ___ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users

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? 2016-

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 about it is that the v

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 i

Re: [swift-users] Weird protocol behaviour.

2016-12-30 Thread Rien via swift-users
> On 30 Dec 2016, at 17:26, Mikhail Seriukov wrote: > > 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 n

[swift-users] question about swift and c callbacks

2016-12-30 Thread Yang Yang via swift-users
I try to wrap a c library in swift package named Test. The code looks like this: Test1.h struct MyParams { int (*func)(); }; typedef struct MyParams MyParams; Test2.h #include "Test1.h" static int test(){ return 0; } void myTest() { MyParams params; params.func = test; } Then I try to imp

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: > > Test1.h > > struct MyPar

Re: [swift-users] Weird protocol behaviour.

2016-12-30 Thread Slava Pestov via swift-users
When you call foo(_: A) with a concrete type C, the type checker performs a conformance check of C to P. If C is a protocol type, the conformance check fails. Ie, unlike the subtype relation (roughly, “I can assign a value of this type to that”), the conformance relation (“I can substitute this