Syntax of the Future Past

There is a fair amount of complaining on The Internets at the moment about Objective-C and Apple’s choice to use it for the iPhone. Many newcomers to the ‘platform’ (if I can apply a singular name to Mac and iPhone development) are finding the language - and the Cocoa frameworks based on it - very confusing. Just how can a language with sooooo many square brackets! be at-all easy to use, after all?

This provoked some deja-vu. Hadn’t, my vague memories asked me, this complaining been done before? I seemed to remember some talk of an “alternate syntax” for Objective-C based on dots from my first WWDC trip in 2001. I turned to the Internet.

It turns out that, yes, this has happened before. Back in 1997, in the Rhapsody days, when Aqua was but a twinkle in Steve Jobs’ eye and the iPhone would have been indistinguishable from magic, Apple was concerned that developers coming from other platforms coming to Rhapsody were intimidated by the Obj-C syntax, and that something would have to be done. The answer was to be the Modern Syntax.

There’s precious little on the web about the proposal. In researching it, I felt a bit like an information archaeologist. These were the days before blogs, remember, and the Rhapsody community was basically composed of the small number of NeXT developers so confident in the technology that they had actually managed to delude themselves into thinking that beleaguered Apple could make it successful where NeXT had failed. What little information that is still available is on Usenet newsgroups (thank you, Google, for preserving these), mailing list archives and magazine articles (remember when magazines were a source of cutting-edge information?).

The earliest references I could find were some talk of the proposal on the Omni Group’s macosx-talk list in 1997. It was plainly a serious proposal at the time. Quoting from Christopher Nagel’s message about the syntax in which he quotes from an Apple document:

“The current message expression syntax of Objective-C is based on Smalltalk. This syntax is sometimes referred to as the classic syntax. There is a proposal to create a modern syntax for message expressions based on Java and C++, because of its greater familiarity. This also is a step toward enabling developers to use either Java or Objective-C to access the libraries. You should be aware as you study Objective-C that the message expression syntax is likely to change in the Rhapsody release to the modern syntax.”

The proposal was controversial, to say the least. On the one hand, it did seem to imply that Objective-C would live on at a time where its community felt very threatened by Java (amongst other things), but on the other hand, it was destroying what some saw as the ‘beauty’ of the language, and what little concrete was leaking out of Apple about it did not appear well thought-out. The proposal did get to the implementation stage, at least within Apple, and the syntax did exist - there was even a compiler flag to turn it on, as this message to comp.lang.objectivec circa 2001 attests (although by that time, the effort had been abandoned), but I could find no concrete examples of it. This 1997 MachTech article, an interview with the authors of CodeWarrior (remember that?), shows their take on it. They obviously thought that the syntax was coming, and here to stay. No methods with more than one argument are shown though, and they say that “We will support this as a real modern syntax specification falls into place”, which implies that the syntax they show might all be guesswork on their part. If anyone has some real examples of Modern Syntax Objective-C, I would be intrigued to see them.

In the end, the revolt from the ObjC community (and perhaps also, if I was to speculate, technical arguments inside Apple akin to the ones taking place on the Omni lists that I linked to above) killed the proposal. By October 1997 - only three months after the original proposals were being discussed - this quote from an Apple Rhapsody FAQ was posted to Omni’s macosx-dev mailing list:

Q: Will you be adding "modern syntax" for Objective-C?

A: At WWDC, we discussed an investigation into a modern syntax. It became clear that Objective-C developers prefer the current syntax, and that programmers of other languages were eager to use Java as their language of choice. As a result we will focus our efforts on moving Objective-C forward and deliver a complete Java solution. The modern syntax effort will not continue

This was not the triumph that the ObjC guys were hoping for, however. By 2001, Cocoa-Java was being pushed as the next-big-thing, and Objective-C was still in for a tumultuous ride. But that’s another story.


I’ve got a copy of the Rhapsody Developer’s Guide, a lot of the examples are in classic syntax, modern syntax, and Java. As an example:

TTriangle *myTriangle = (Triangle.alloc).init; [modern] TTriangle *myTriangle = [[Triangle alloc] init]; [classic]

This syntax was never, as far as I both remember and can tell, put into a real compiler. It would have caused compatibility problems, because the selector for -initWithCoder: in the classic syntax is @selector(initWithCoder:) but in the modern syntax it’s @selector(initWithCoder), to try and match the calling convention: MyView *myView = (MyView.alloc).initWithCoder(aCoder);. Fine, but what if you have the plausible edge case -foo, -foo: and -foo::?

I think it’s easy with the blinkers of hindsight to laugh at how much effort Apple put into Java, and how long it took to kill the bridge. At the time, though, it was plausibly the future of the platform: there were only a handful of Objective-C programmers in the world, and many of them had already been poached by Sun during the OPENSTEP joint effort. Those developers ended up working on Oak, which became Java but was in some eyes "Objective-C done right" (or "Objective-C 2.0", if you’ll pardon the pun). Java had all of the type safety and automatic memory management that people thought lacking from ObjC, ISVs indicated a preference not to learn ObjC…Java was modern, cross-platform, less alien and supported by someone else’s engineers.

Stan Shebs’ message to comp.lang.objectivec seems to suggest that it was working at some point (unless invoking his compiler flag just errored out).

I’m interested to see how multi-argument selectors were handled - for example, what would "[myDict setObject:obj forKey:key]" look like? Is there anything like that in the guide?

I’m also a little weirded by "(Triangle.alloc).init;" - why not "Triangle.alloc.init;"? Would the new ‘.’ ‘operator’ really bind in the wrong direction for that?

It’s possible that the answer for multi-args might have been "don’t have multiple numbers of nameless parameters", but I can’t prove that. However, this example for using NSPasteboard, where I’m only quoting the useful line, demonstrates that actually the problem would occur in multiple contexts (particularly the whole multiple initialisers context):

[documentHandler addChartOfType: data fromServicePasteboard: pasteboard]; [classic] documentHandler.addChartOfType(data, pasteboard); [modern]

Now, hopefully the problem there is evident (and the analogue that NSDictionary would be used as dict.setObject(obj, key);). The guide suggests that while different methods are sent in these cases, "you can consider this to be a single message with optional arguments".

Regarding the alloc/init dance, I think on reading the guide that I could have done Triangle.alloc().init() and avoided the problem: I can’t find an explicit confirmation of that. The guide is ISBN 0-12-251334-7.