4 ms·
The issue is that Objective-C GC was a failure, but not for the reasons Apple marketed its pivot into RC. Thankfully the documentation is still available, so t
by pjmlp 2y ago
The issue is that Objective-C GC was a failure, but not for the reasons Apple marketed its pivot into RC.
Thankfully the documentation is still available, so those that were there can dig it out from the archives,
"Inapplicable Patterns"
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcInapplicablePatterns.html#//apple_ref/doc/uid/TP40006762-SW1 https://developer.apple.com/library/archive/documentation/Co...
"Managing Opaque Pointers"
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcUsing.html#//apple_ref/doc/uid/TP40008006-SW4 https://developer.apple.com/library/archive/documentation/Co...
"Compile GC-Only"
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcEssentials.html#//apple_ref/doc/uid/TP40002452-SW15 https://developer.apple.com/library/archive/documentation/Co...
"Memory Management Semantics"
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/GarbageCollection/Articles/gcCoreFoundation.html#//apple_ref/doc/uid/TP40006687-SW3 https://developer.apple.com/library/archive/documentation/Co...
A few entry points into the documentation, where several ifs and buts are described on how to make use of Objective-C GC, without possibility having things go wrong.
All of this contributed for Objective-C not being a sound implementation with lots of radar issues and forum discussions, as you might expect trying to make existing projects, or any random Objective-C or C library now work under Objective-C GC semantics and required changes, wasn't that easy.
Naturally having the compiler automate retain/release calls, similar to how VC++ does with _com_ptr_t (which ended up being superseded by other ways) for COM, was a much better solution, without requiring a "rewrite the world" approach.
Automate a pattern developers were already expected to do manually, and leave everything else as it is, without ifs and buts regarding code best practices, programming patterns, RC / GC interoperability issues with C semantics and so on.
The existing retain/release calls wouldn't be manually written any longer, everything else stays the same.
Naturally Apple being Apple, they had to sell this at WWDC as some kind of great achievement of how RC is much better than GC, which in a sense is correct but only from point of view of the underlying C semantics and the mess Objective-C GC turned out to be, not tracing GC algorithms in general.