3 ms·
Every Cocoa app I've written has used "[NSObject performSelectorInBackground:withObject:]", which relies on having a thread-safe GC (atomic reference counting).
by pcwalton 12y ago
Every Cocoa app I've written has used "[NSObject performSelectorInBackground:withObject:]", which relies on having a thread-safe GC (atomic reference counting).
- moe 12y agoAnd just as Cocoa abstracts this away from you any popular Nim frameworks that need such optimisations will also abstract them away from you.
- pcwalton 12y agoI don't see how. The abstraction here is automatic memory management -- i.e. the GC -- and the problem is that the abstraction doesn't work for this popular use case. The language needs to provide a more flexible abstraction: a thread-safe GC. And it's not a question of optimization, it's a question of semantics. Performing an operation in a background thread with a strong mutable reference to an object is a semantic concept. Without a thread-safe GC you simply can't do it.