Re:Swift was always going to be part of the OS
by koito17 on Saturday December 16, 2023 @02:58PM
(#38667194)
What Apple calls "ARC", the rest of the word simply calls "RC". Unlike in Objective-C, the vast majority of RC implementations do not need the developer to modify refcounts by hand. It was already "automatic", so to speak.
Moreover, ARC itself indeed modifies refcounts atomically. If it didn't, you would not be able to reliably determine the liveness of an object shared between threads. Now ask yourself whether atomically updating dozens of integers is faster than flipping a bit across a table of pointers.
Re:Swift was always going to be part of the OS
by pjmlp on Sunday December 17, 2023 @04:54AM
(#38671706)
Basically Apple turned Objective-C's GC failure to deal with C semantics, picked COM's approach to smart pointers, and made a market message out of it into ARC, for people that never dealt with this kind of stuff before.
Like in many things where "Apple did it first".
Re:Swift was always going to be part of the OS
by kaba0 on Saturday December 16, 2023 @02:56PM
(#38667177)
ARC can stand for multiple things and is more of a marketing name here, than anything. The relevant garbage collector algorithm is called reference counting - and depending on whether it is single-threaded or have to do it over multiple threads, it can have quite a big overhead. Also, ObjC was also ref counted AFAIK before.
Re:Swift was always going to be part of the OS
by pjmlp on Sunday December 17, 2023 @04:51AM
(#38671691)
Yes, everyone that points that out usually has no idea that Objective-C GC failed due to C's semantics making it quite prone to crashes, and that automating Cocoa's retain/release calls was a much more easier and safer approach than making C code work in a sensible way beyond what a conservative tracing GC will ever be able to offer, while dealing with C pointers all over the place.
Apple's frameworks used GC before, and they switched to ARC.