Re: [swift-users] Can I use a tuple to force a certain memory layout?

2017-07-19 Thread David Sweeris via swift-users
> On Jul 19, 2017, at 20:33, Taylor Swift via swift-users > wrote: > > Many APIs like OpenGL take arrays where the atomic unit is multiple elements > long. For example, a buffer of coordinates laid out like > > :[Float] = [ x1, y1, z1, x2, y2, z2, ... , xn, yn, zn ] > > I want to be able to

[swift-users] Can I use a tuple to force a certain memory layout?

2017-07-19 Thread Taylor Swift via swift-users
Many APIs like OpenGL take arrays where the atomic unit is multiple elements long. For example, a buffer of coordinates laid out like :[Float] = [ x1, y1, z1, x2, y2, z2, ... , xn, yn, zn ] I want to be able to define *in Swift* (i.e., without creating and importing a Objective C module) a struct

[swift-users] NSSpeechSynthesizer module obsolescence?

2017-07-19 Thread Yuma Decaux via swift-users
Hi, I'm doing a lot of audio buffering stuff to learn real time audio synthesis and generation, and find the NSSpeechSynthesizer class to be a bit lacking on OSX compared to IOS. Principally frustrated with not knowing where I can capture the synthesized buffer before it goes into the output. D

Re: [swift-users] ⁨Is it possible to store a set of heterogeneous items with protocol?

2017-07-19 Thread Howard Lovatt via swift-users
You are hardly alone struggling with this, it seems to come up every other week! You can write your own custom AnyProtocol type that includes Self, a pain but doable, e.g.: protocol A { func a() -> String } protocol B { func b() -> String } struct AB1: A, B, Hashable { func a() -> Str

Re: [swift-users] matching a protocol value in multiple patterns is not yet supported; use separate cases instead

2017-07-19 Thread Jordan Rose via swift-users
> On Jul 18, 2017, at 18:17, Zhao Xin via swift-users > wrote: > > I encounter this error today. "matching a protocol value in multiple patterns > is not yet supported; use separate cases instead" > > Sample code: > > import Foundation > > protocol NameProtocol { > var name:String { get

Re: [swift-users] ⁨Is it possible to store a set of heterogeneous items with protocol?

2017-07-19 Thread David Hart via swift-users
> On 19 Jul 2017, at 09:22, Glen Huang via swift-users > wrote: > > Thanks for the heads up. > > I wonder what’s the root cause of the difficulty to make "such an existential > conform to Hashable in a general way”. Is it because objects of different > types have local definitions for hash v

Re: [swift-users] ⁨Is it possible to store a set of heterogeneous items with protocol?

2017-07-19 Thread David Hart via swift-users
> On 19 Jul 2017, at 09:22, Glen Huang via swift-users > wrote: > > Thanks for the heads up. > > I wonder what’s the root cause of the difficulty to make "such an existential > conform to Hashable in a general way”. Is it because objects of different > types have local definitions for hash v

Re: [swift-users] ⁨Is it possible to store a set of heterogeneous items with protocol?

2017-07-19 Thread Glen Huang via swift-users
Thanks for the heads up. I wonder what’s the root cause of the difficulty to make "such an existential conform to Hashable in a general way”. Is it because objects of different types have local definitions for hash value, thus making it impossible to compare them directly? Go is able to handle