Re:Should I use a Swift struct or a class?
by grabcocque on Saturday July 04, 2015 @12:30PM
(#9830637)
In the presence of concurrency, shared mutable state is a disaster. There are two ways to fix this:
1) Make it not mutable 2) Make it not shared
But these are still "state", so I'm not really sure what the hell the article is on about.
Re:Should I use a Swift struct or a class?
by oldmanjay on Saturday July 04, 2015 @03:59PM
(#9831416)
3) synchronize correctly, which is fraught in nearly all languages. Rust has some very nice facilities for this, however, that make shared mutable state very usable indeed.
Re:Should I use a Swift struct or a class?
by seanmcdirmid on Saturday July 04, 2015 @04:14PM
(#9831458)
If you don't have shared mutable state or shared resources, then you don't really have concurrency. Concurrency is actually defined as this problem, as opposed to parallelism which is just about splitting up work.
State changes are fine! They just aren't allowed to be hidden.
Despite all that - I agree that move semantics are weird. He's got a point there.