Re:Close Encounters of the Java Memory Model Kind
by chvid on Thursday June 23, 2016 @04:49AM
(#11959643)
How would you write the code (and JCStressTest tool) corresponding to the article in Swift?
[ Parent
| on HN ]
Re:Close Encounters of the Java Memory Model Kind
by chvid on Thursday June 23, 2016 @05:30AM
(#11959759)
To answer my own question: You cannot.
To answer your question: Very unlikely. Swift has a lot of irrelevant complexity from its Apple/Objective-C interop, poor reflection support, poor IDEs (Xcode) compared to established platforms such as Java 8 or alternatives such as Kotlin, Scala and so.
Re:Close Encounters of the Java Memory Model Kind
by abalone on Thursday June 23, 2016 @06:02AM
(#11959848)
I don't know the exact answer, but Swift takes a higher-level task/queue approach to concurrency, letting the OS handle more of the underlying thread management. So if you wanted to write a concurrency stress test you'd probably write it on top of those constructs.[1]
I'm not sure what you mean by "irrelevant complexity". Maybe you could cite some examples. Limited reflection/dynamism was an intentional design choice for greater safety, and there are complaints, but it's not without benefit. And it's a bit hasty to criticize lack of IDE support when it was just open sourced 7 months ago. That's like criticizing Scala for lack of IDE support.. in 2005.
[1] see https://developer.ibm.com/swift/2016/02/22/talking-about-swi...
Re:Close Encounters of the Java Memory Model Kind
by jerven on Thursday June 23, 2016 @04:31PM
(#11964071)
While the constructs are higher level, the compiler still needs to deal with all of this complexity. Normal developers can ignore this. But there will be a memory model and a modern language should specify this. If swift does not have an equivalent idea of what its memory model should be, the ARM/X86 splits will lead to interesting bugs.