Re: [swift-users] [swift-corelibs-dev] [swift-evolution] WWDC Meetup

2016-06-09 Thread David Hart via swift-users
Hi all, I have some news on the WWDC meet-up that was announced earlier this week. Thanks to the help of a friendly community member, Bert Belder, we have been able to secure a very cool venue! The meetup will take place on Tuesday, June 14th at 7pm, in the IBM Bluemix Garage, which is at abo

Re: [swift-users] proper syntax for inout array handling?

2016-06-09 Thread Joe Groff via swift-users
> On Jun 9, 2016, at 8:39 PM, Saagar Jha via swift-users > wrote: > > Nevermind, I lied. Swift does allow direct pointer arithmetic: > > import Foundation > > var source = [UInt8](repeating: 0x1f, count: 32) > var destination = [UInt8](repeating: 0, count: 64) > > memcpy(&destination, source

Re: [swift-users] proper syntax for inout array handling?

2016-06-09 Thread Saagar Jha via swift-users
Nevermind, I lied. Swift does allow direct pointer arithmetic: import Foundation var source = [UInt8](repeating: 0x1f, count: 32) var destination = [UInt8](repeating: 0, count: 64) memcpy(&destination, source, 32) // the C function memcpy(&destination + 3, source, 13) // the + operator works to

Re: [swift-users] proper syntax for inout array handling?

2016-06-09 Thread Saagar Jha via swift-users
Swift handling of Arrays isn’t like C (for which you can use UnsafePointer)-you don’t access the pointer of the third element. Instead, you can use Array slices, which makes it a one liner: destination[destinationStartIndex.. wrote: > I am converting a very dirty C program to Swift3, and their is

[swift-users] proper syntax for inout array handling?

2016-06-09 Thread Ken Burgett via swift-users
I am converting a very dirty C program to Swift3, and their is plenty of pointer arithmetic to be dealt with. As part of the effort, I have created a 'memcpy clone to help with some of the transformation. Here is the output from the REPL: 1. var source = [UInt

Re: [swift-users] Constrained protocol extensions

2016-06-09 Thread Jordan Rose via swift-users
Swift generics are not like C++ templates; they are built on dynamic dispatch at runtime instead of instantiation, much like Java interfaces. Overload resolution, on the other hand, happens at compile-time, with "more specific” overloads being preferred over “less specific” ones. (The exact orde

Re: [swift-users] Constrained protocol extensions

2016-06-09 Thread apetro...@outlook.com via swift-users
Hi Ian, You're right, if there's a function that's specialized everything works well (actually, I deleted exactly the same function from my example, in an attempt to be brief and succinct :) ). But that kind of ruins the whole point of interface specialization and violates the principle of leas