Sam Soffes changelog.com/posts

Mike Ash reimplements most of NSObject functionality with MAObject for educational purposes

Mike Ash wrote a fantastic article about reimplementing NSObject. It’s really fascinating.

From his post:

The NSObject class 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 NSObject from scratch, as suggested by friend of the blog and occasional guest author Gwynne Raskind.

He goes through memory management, inheritance, performing selectors, etc. Most of the heavy lifting is done by the runtime. It’s really amazing to see how simple it is to make this. I know I’ve thought the source code for NSObject must some crazy magic.

I highly recommend reading his article and checking out the source on GitHub.


Discussion

Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00