Re: [swift-users] Dimensional analysis

2016-11-30 Thread Howard Lovatt via swift-users
Another feature I would like would be a dimensions wrapper for an array. So that I can mark all values in the array as having the same units, rather than mark each individual element as having a particular unit. It is conceivable that wrapping each element, both performance and memory wise, is OK

Re: [swift-users] Dealing with loss of observers on protocol properties with default implementations

2016-11-30 Thread Tino Heth via swift-users
> I find this to be an ugly solution. Particularly so since non-objc protocols > don't support optional members. Compare this to using a base class: If inheritance works well, I wouldn't insist on protocols just for the sake of it. This wont help with structs, but your example uses a class… and

[swift-users] Dealing with loss of observers on protocol properties with default implementations

2016-11-30 Thread Neil via swift-users
Hi folks, I'm curious to know how others have handled the loss of property observers when a protocol property has a default implementation. For example, consider the following simple protocol declaration: protocol Widget : class { associatedtype IdentifierType var identifier: Identifi

Re: [swift-users] Capture values by Closures in different background threads.

2016-11-30 Thread Jordan Rose via swift-users
When not using a capture list, Swift closures always refer to variables, not to their values. So here you’re not capturing copies, you’re capturing the actual variable ‘test’, and the mutating function will update it. (If you did capture a copy, it would be immutable, and the call to ‘newNum(new

Re: [swift-users] Capture values by Closures in different background threads.

2016-11-30 Thread Jeremy Pereira via swift-users
> On 30 Nov 2016, at 10:38, Седых Александр via swift-users > wrote: > > Assume we have this code: > > Immediately two Timer's closures captured two copy of initial values of > instance Test, with internal num values is 0. > > //: Playground - noun: a place where people can play > > impo

[swift-users] Atomics and Memory Fences in Swift

2016-11-30 Thread Anders Ha via swift-users
Hi guys I have recently started adopting lock-free atomics with memory fences, but it seems Swift at this moment does not have any native instruments. Then I read a thread in the Apple Developer Forum (https://forums.developer.apple.com/thread/49334

[swift-users] Capture values by Closures in different background threads.

2016-11-30 Thread Седых Александр via swift-users
Assume we have this code:   Immediately two Timer's closures captured two copy of initial values of instance Test, with internal num values is 0.   //: Playground - noun: a place where people can play   import UIKit   var str = "Hello, playground"   struct Test {     var num = 0     mutating

Re: [swift-users] Dimensional analysis

2016-11-30 Thread Maury Markowitz via swift-users
Let me add my support for this as well. I am currently using a bridge version of: https://github.com/unixpickle/Expressions And it works quite well. But I think a pure Swift implementation, especially with dimensional analysis, would be useful to a great number of people. __