Friday April 20, 2012

Automatic Boxing

More good stuff in the Objective-C department. Patrick Beard over on the objc-language Apple mailing list brough up the new syntax for boxed expressions they are working on. You’ve probably noticed the ability to specify numeric literals in the upcoming Xcode like so:

// Old
NSNumber *num = [NSNumber numberWithInt:1];

// New
NSNumber *num = @(1);

But you weren’t able to pull that off at run time. With this change coming, you’ll be able to use that syntax to automatically box numbers and strings with this new syntax. Apple cleared a lot of cruft out of the way by supporting clang development to replace gcc. These new syntax changes are coming faster and faster, now.