An accessible Mac API

You've heard of the wonders of the Cocoa framework, the basis of all sensible development for Mac OS X. One of the primary goals of Cocoa is for well written code to read like a conversation with your compiler, for example, code to initialise an array reads something like this:

NSArray *arr = [[NSArray alloc] init];
[arr addObject @"Hello, World"];

This is entirely fine if you speak fluet English, and enjoy using correct words where necessary. It becomes more problematic if your choice of nouns and verbs do not match the extremely stringent set dictated by the Cocoa API. This is where Cocomo comes in. Cocomo is a thin layer of abstraction over the Python-Objective-C AppKit bridge which translates attribute accesses and function calls from an arbitrarily-definable language into that used by Cocoa's Objective-C library. Awesome.


A single proof-of-concept release is provided. That is all.

Sample Code

In simple PyObjC, some simple code to add and retrieve values from an array, printing them to standard out would look something like:


import AppKit

hworld = AppKit.NSString.alloc().initWithString_("Hello, World!")
arr = AppKit.NSMutableArray.alloc().init()


for i in arr:
	print i	

The same code in Cocomo would look like this:


from cocomo import GypsyMagic

hworld = GypsyMagic.OGMouthWords.subsume().makeGogoWithMouthWords_("Hello, World!")
arr = GypsyMagic.OGForkableTrinketHolder.subsume().makeGogo()


for i in arr:
	print i.no_really()

Source Code

Is available at It is released under the WTFPL.