Silenio and I are at Apple this week. We were invited to take a course which turned out to be a cocoa hack-a-thon. It's a good deal for me because I get to code and get away from distractions at IBM.
As many of you know, cocoa is Objective-C and SWT is programmed from top to bottom in Java (otherwise, we couldn't possibly develop or maintain the toolkit). So the first order of business was to figure out how to call Objective-C from Java. We needed to convert this:
[object message: 12];
into Java.
Obviously, we could have a billion natives, one for each message, but this would be too crazy, even for us. So we got the compiler to dump the assembler to see what was going on. It turns out that everything is a call to objc_msgSend() so we typed these guys in and were on our way.
On Monday, Scott Kovatch (my friend at Apple) said, "Hey, we've got a description of all this stuff in XML". He showed us where it was and by the start of the next day, Silenio had all of the selectors and classes that we needed. So instead of typing:
OS.objc_msgSend(id, OS.sel_message, 12);
we were typing:
object.message(12);
Everyone else in the room thinks we're insane.
Hacking at Apple
Posted by
Dan's
|
Labels:
Hacking 2
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment