Re: [swift-users] Simultaneous accesses, but modification requires exclusive access

2017-07-30 Thread somu subscribe via swift-users
Thanks a lot Hooman, I understand better now. The part that tripped me was the fact that value types would be copied every time. I didn’t realise I wasn’t making a copy of the value type in my program, the same instance of the value type was getting passed (as Quinn and you had pointed out).

Re: [swift-users] Law of Exclusivity runtime false positive?

2017-07-30 Thread Andrew Trick via swift-users
> On Jul 30, 2017, at 5:11 AM, David Hart via swift-users > wrote: > >> >> On 28 Jul 2017, at 18:55, Joe Groff > > wrote: >> >>> >>> On Jul 28, 2017, at 12:06 AM, David Hart via swift-users >>>

Re: [swift-users] Simultaneous accesses, but modification requires exclusive access

2017-07-30 Thread Hooman Mehr via swift-users
> On Jul 24, 2017, at 2:38 AM, somu subscribe via swift-users > wrote: > > Thank a lot Quinn, your solution to use inout works well without crashing. > > Question 1: > - Also changing Helper to a class doesn’t seem to crash. Is that a solution > that wouldn’t cause a

Re: [swift-users] Extending 2D arrays of genetic type

2017-07-30 Thread Hooman Mehr via swift-users
You can do something like this: extension Collection where Element: Collection, Index == Element.Index { subscript(i: Index, j: Index) -> Element.Element { get { return self[i][j] } } } extension MutableCollection where Element: MutableCollection, Index == Element.Index {

[swift-users] TWISt-shout Newsletter 2017-07-31

2017-07-30 Thread Kenny Leung via swift-users
Hi All. Here is your TWISt-shout Newsletter for the week of 2017-07-24 to 2017-07-30 https://github.com/pepperdog/TWISt-shout/blob/master/2017/TWISt-shout-2017-07-31.md Enjoy! -Kenny

Re: [swift-users] Law of Exclusivity runtime false positive?

2017-07-30 Thread David Hart via swift-users
> On 28 Jul 2017, at 18:55, Joe Groff wrote: > >> >> On Jul 28, 2017, at 12:06 AM, David Hart via swift-users >> > wrote: >> >> Hello, >> >> Indeed, I had reduced the code too much. John McCall was kind enough to have

Re: [swift-users] Simultaneous accesses, but modification requires exclusive access

2017-07-30 Thread somu subscribe via swift-users
Thanks a lot Zhao, using a serial queue works. So both the solutions works, thanks. > On 24 Jul 2017, at 5:39 PM, Zhao Xin via swift-users > wrote: > > You can use serial queue. > > class Car { > var helper = Helper() > lazy private var queue =

[swift-users] Extending 2D arrays of genetic type

2017-07-30 Thread Trevör ANNE DENISE via swift-users
I am trying to extend a 2D array, doing something like this: extension Array where Element == Array { } But this doesn't work ! Is there a way to do this ? Thank you ! :) Trevör ___ swift-users mailing list swift-users@swift.org

Re: [swift-users] Constraining the conforming type of a protocol

2017-07-30 Thread Joanna Carter via swift-users
IMHO, there is a very subtle difference between : protocol Toggling : Equatable { … } extension Toggling { … } … and : protocol Toggling { … } extension Toggling where Self : Equatable { … } The first says that any type that implements Toggling also implements Equatable. The second

Re: [swift-users] Constraining the conforming type of a protocol

2017-07-30 Thread Ray Fix via swift-users
Cool. Thanks for your comment. Done. https://bugs.swift.org/browse/SR-5581 Ray > On Jul 29, 2017, at 5:55 PM, Slava Pestov wrote: > > What you’re trying to do should be equivalent to this: > > protocol Toggling : Equatable { >