|
Topics > Blog > Objective-J and Objective-C
Objective-J and Objective-C
Just a little over a week ago, Chris Lattner announced to the Clang mailing list that Apple was adding something called "blocks" to C. These blocks are basically closures in the same sense that any computer science student would use them in Lisp, except with a few extra twists of memory management thrown in. (Specifically, if you want to mutate variables declared outside the block, you have to use a new storage qualifier, Today, the anticipated "Objective-J" framework used to build the impressive 280 Slides web application was released, along with a Cocoa-inspired (almost Cocoa-cloned) framework known as Cappuccino. In some cases it seems almost too close, with methods like Anyway, so I think blocks are cool, and would like to start using them except I try to maintain backwards compatibility. (Think about alert sheet callbacks, though!) Objective-J is pretty cool but I want to see some performance specs (though I'm sure it's faster than an overly-AJAXed site). What I find interesting, though, is this snippet from the Objective-J Tutorial's Methods section:
At the same time, Objective-C, and indeed pure C as well, gets the use of blocks:
// something like this
[fooObject setCallback:^(NSString *title, NSString *company) {
// do stuff
}];
...and while this is no good for bindings, and maybe even not target-action replacement, it's great for callbacks. Ironic that the two languages seem to pass each other in the mist. Personally, I've been finally won over to Blocks since they don't seem to mess up C at all (unlike some other closure syntaxes I've seen which only work in a high-level environment). Whereas although using JavaScript functions as first class entities isn't always needed, it seems like it wouldn't be hard to implement. Maybe it was just a problem of copying the syntax a little too closely. *grin* Posted by jediknil | 04 Sep 2008 12:16:41 Comments | ||
| Powered by | BlogAgain | Apache | MySQL | PHP | |