accessors(2) arc(4) assembly(3) assert autorelease(2) blocks(5) bug c(4) c++(2) chemicalburn clang(2) cocoa(18) code(2) continuation continuations defensive disassembly(3) enumeration errorhandling evil(4) fridayqa fridayqna(43) garbagecollection guest(3) hack(8) hash init initializer iphone isequal leopard(2) letsbuild(10) memory(3) nscoding nsfastenumeration objectivec(59) override performance(4) pyobjc python rant serialization singleton sourcecode(2) stl super swizzling threading(2) translation vararg
MAInvocation. In that article, I discussed the basic theory, the architecture calling conventions, and presented the assembly language glue code needed for the implementation. Today, I present the Objective-C part of
NSInvocation, and I have obliged, implementing it from scratch for your amusement. Today I'll start on a guided tour down the hall of horrors that is
MAInvocation, my reimplementation of the
NSInvocationAPI. It's a big project, so today I'm going to focus on the basic principles and the assembly language glue code, with the rest of the implementation to follow.
NSObject. I left out key-value coding, because the implementation of
setValue:forKey:is complex enough to need its own article. This is that article.
NSObjectclass lies at the root of (almost) all classes we build and use as part of Cocoa programming. What does it actually do, though, and how does it do it? Today, I'm going to rebuild
NSObjectfrom scratch, as suggested by friend of the blog and occasional guest author Gwynne Raskind.
objc_msgSendfunction underlies everything we do in Objective-C. Gwynne Raskind, reader and occasional Friday Q&A guest contributor, suggested that I talk about how
objc_msgSendworks on the inside. What better way to understand how something works than to build it from scratch? Let's build
NSNumberclass. Starting on Mac OS X 10.7 and iOS 5,
NSNumberuses a new runtime facility called tagged pointers to increase speed and reduce memory usage, the inner workings of which I want to examine today.
NSNumberis a deceptively simple class with some interesting implementation details. In today's edition of Friday Q&A, I'll explore how to build a class that works like
NSNumber, a topic suggested by Jay Tamboli.
__weakvariables, and calling through to the original implementations where available. Today, I'm going to discuss the implementation of the zeroing weak reference facility that gets used when the runtime doesn't supply its own
PLWeakCompatibility. This is a small library that can be dropped into an app to enable use of the
__weakqualifier on OSes that don't support it. ARC is officially supported on Mac OS X 10.6 and iOS 4, but
__weakis only available on 10.7 and iOS 5.
PLWeakCompatibilityadds support for
__weakon those older OSes when using ARC. Today I'm going to discuss how
PLWeakCompatibilityworks on the inside.
__weakvariables on those older OSes? If so, then I have good news for you! PLWeakCompatibility is the solution you've been looking for.
NSMutableArray. Today, I'll repeat the same exercise with
NSMutableDictionaryand build an implementation of it from scratch.
NSMutableArrayworks behind the scenes by building a replacement for it from scratch.
warning: no '-fooMessage' method found (Messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments.)You double-check your code and your method name is correct, so you shrug and move on. A few hours later, your program starts misbehaving strangely. What's going on? Today, I'll explore the mysterious world of Objective-C method signature mismatches, a topic suggested by an anonymous reader.
NSCodingin Objective-C classes.
MAZeroingWeakRef. In short, it's a library which allows zeroing weak references to be used in retain/release Cocoa code. This has all sorts of uses and should make retain/release coding less painful. While I discussed this in detail in my Friday Q&A post this week, I also want to make a separate announcement for people who don't want to read through all of the horrible details.
NSError **call into CPS style with virtually no work. Source code and extensive examples are available, and I encourage you to check it out.
@dynamicproperties work in CoreData and I'm going to take that and expand it to talk about message forwarding in general.