News for hackers. Stuff that matters.
Re:Swift 3.0 Unsafe World by kbsletten on Tuesday September 27, 2016 @10:16AM (#12589707)
Well, passing raw pointers to garbage collected objects is impossible without language support for "pinning". This is because the GC will move objects around in memory breaking any pointers you're using in your C code. That may be a generous interpretation of the author (it could just be bile), but in the context of the article (about C interoperability) that's what comes to mind.
Re:Swift 3.0 Unsafe World by pjmlp on Tuesday September 27, 2016 @10:55AM (#12590024)
That's not quite true.

For example, in Cedar, Modula-3, Active Oberon, D you can mark a pointer as not being under GC control.

Other GC enabled systems programming languages offer similar feature.

Re:Swift 3.0 Unsafe World by masklinn on Tuesday September 27, 2016 @11:11AM (#12590185)
> This is because the GC will move objects around in memory

Not necessarily, you could use (and guarantee) a non-moving GC. Moving is but one of the attributes/details you can use for your GC.

Re:Swift 3.0 Unsafe World by mikeash on Tuesday September 27, 2016 @01:48PM (#12591483)
And this is definitely not just theoretical. Any conservative collector must also be non-moving. The Boehm GC for C and C++ and Apple's GC for Objective-C are both existing examples.
Re:Swift 3.0 Unsafe World by masklinn on Tuesday September 27, 2016 @02:11PM (#12591652)
IIRC Go's GC is also non-moving for now (or has that changed in a recent version? I believe it was still non-moving around 1.5)