Re: [swift-users] What is "binding" memory?

2016-11-04 Thread Andrew Trick via swift-users
> On Nov 4, 2016, at 12:16 AM, Rien wrote: > > Thanks Any, most informative. > > So the pointer “gateway’s” are in fact ephemeral. That is good for > performance. > > As to the low level interfaces, are you aware of any effort that addresses > the POSIX socket functions? > (Things like ‘addr

Re: [swift-users] hashValue of enum cases (was Reducing Array to OptionSet)

2016-11-04 Thread Erica Sadun via swift-users
It is absolutely an implementation detail and one you should never rely upon! — Erica Sent from my iPhone > On Nov 4, 2016, at 2:17 PM, Fritz Anderson wrote: > >> On 3 Nov 2016, at 8:37 PM, Erica Sadun via swift-users >> wrote: >> >> private enum StringEnum: String { case one, two, thr

Re: [swift-users] Understanding pass-by-value

2016-11-04 Thread Brent Royal-Gordon via swift-users
> On Nov 4, 2016, at 9:45 AM, Ryan Lovelett wrote: > > Just out of curiosity if I looked at the SIL, would that allow me to see > any of that in action? Or would it be too opaque? Maybe. What might be more directly useful is looking at the source for `Data` in Foundation:

Re: [swift-users] Planned Maintenance: Today at 12pm

2016-11-04 Thread mishal_shah via swift-users
Maintenance completed. > On Nov 4, 2016, at 11:36 AM, mishal_shah via swift-users > wrote: > > Hi, > > Swift CI (ci.swift.org) will be down for maintenance, please don’t trigger CI > testing. > > When? > Nov 4th 2016 - 12pm PST > > Thanks, > Mishal Shah > ___

[swift-users] hashValue of enum cases (was Reducing Array to OptionSet)

2016-11-04 Thread Fritz Anderson via swift-users
On 3 Nov 2016, at 8:37 PM, Erica Sadun via swift-users mailto:swift-users@swift.org>> wrote: > private enum StringEnum: String { case one, two, three } > public init(strings: [String]) { > var set = MyOptionSet() > strings.flatMap({ StringEnum(rawValue: $0) }) >

[swift-users] Planned Maintenance: Today at 12pm

2016-11-04 Thread mishal_shah via swift-users
Hi, Swift CI (ci.swift.org) will be down for maintenance, please don’t trigger CI testing. When? Nov 4th 2016 - 12pm PST Thanks, Mishal Shah ___ swift-users mailing list swift-users@swift.org https://lists.swift.org/mailman/listinfo/swift-users

Re: [swift-users] Understanding pass-by-value

2016-11-04 Thread Joe Groff via swift-users
> On Nov 4, 2016, at 10:12 AM, Rien via swift-users > wrote: > > >> On 04 Nov 2016, at 17:48, Ryan Lovelett wrote: >> >>> I often end up “printing” the addresses or using GDB to take an inside >>> look. >> >> That is a really simple interrogation technique I wish I had thought of >> that! T

Re: [swift-users] Understanding pass-by-value

2016-11-04 Thread Rien via swift-users
> On 04 Nov 2016, at 17:48, Ryan Lovelett wrote: > >> I often end up “printing” the addresses or using GDB to take an inside >> look. > > That is a really simple interrogation technique I wish I had thought of > that! Thank you! > >> One thing that tripped me up: if you use inout variables, th

Re: [swift-users] Understanding pass-by-value

2016-11-04 Thread Ryan Lovelett via swift-users
> I often end up “printing” the addresses or using GDB to take an inside > look. That is a really simple interrogation technique I wish I had thought of that! Thank you! > One thing that tripped me up: if you use inout variables, the observers > will be triggered once the function completes. Even

Re: [swift-users] Understanding pass-by-value

2016-11-04 Thread Ryan Lovelett via swift-users
> Do you mean, "did I make two copies of the `Data`, one in a top-level > variable named `d` and the other in a parameter named `buffer`"? That is more precisely what I meant. Mutters to self: "Precision of language, Ryan!" That fairly completely answers my quandary. Thank you for your time and e

Re: [swift-users] Understanding pass-by-value

2016-11-04 Thread Rien via swift-users
> On 04 Nov 2016, at 13:59, Ryan Lovelett via swift-users > wrote: > > struct Foo { > init(from buffer: Data) { > bar = integer(withBytes: Array(buffer[4..<6])) > baz = integer(withBytes: Array(buffer[6..<8])) > ... > } > > let d = Data(count: Int(3e+8)) > let f = Foo(from: d) >

Re: [swift-users] Understanding pass-by-value

2016-11-04 Thread Brent Royal-Gordon via swift-users
> On Nov 4, 2016, at 5:59 AM, Ryan Lovelett via swift-users > wrote: > > struct Foo { > init(from buffer: Data) { > bar = integer(withBytes: Array(buffer[4..<6])) > baz = integer(withBytes: Array(buffer[6..<8])) > ... > } > > let d = Data(count: Int(3e+8)) > let f = Foo(from: d) >

[swift-users] Understanding pass-by-value

2016-11-04 Thread Ryan Lovelett via swift-users
struct Foo { init(from buffer: Data) { bar = integer(withBytes: Array(buffer[4..<6])) baz = integer(withBytes: Array(buffer[6..<8])) ... } let d = Data(count: Int(3e+8)) let f = Foo(from: d) Did I just make two copies of the `Data`? How would I investigate this to understand it

Re: [swift-users] [swift-dev] Initializing constant object graph with cycles

2016-11-04 Thread Brent Royal-Gordon via swift-users
(Crossposted to swift-users; swift-dev is for development of the Swift compiler and standard library, not discussions about how to use Swift.) > On Nov 4, 2016, at 2:57 AM, Anton Mironov via swift-dev > wrote: > > // This is workaround #1 > // It looks bad for 2 reasons: implicitly unwrapped o

Re: [swift-users] What is "binding" memory?

2016-11-04 Thread Rien via swift-users
> On 03 Nov 2016, at 23:58, Manfred Schubert via swift-users > wrote: > > Am 03.11.2016 um 15:41 schrieb Rien : >> >> Ah, but that is not the case. >> >> It is important to differentiate between the “gateway” to the memory and the >> memory area itself. >> Different programming languages/com

Re: [swift-users] What is "binding" memory?

2016-11-04 Thread Rien via swift-users
Thanks Any, most informative. So the pointer “gateway’s” are in fact ephemeral. That is good for performance. As to the low level interfaces, are you aware of any effort that addresses the POSIX socket functions? (Things like ‘addrinfo') Regards, Rien Site: http://balancingrock.nl Blog: http:/