MathEdit running on OpenStep 4.2 OpenStep 4.2

MathEdit running on Mac OS X Jaguar Mac OS X 10.2 Jaguar

MathEdit running on Mac OS X Tiger Mac OS X 10.4 Tiger

MathEdit running on Mac OS X Snow Leopard Mac OS X 10.6 Snow Leopard

MathEdit running on OS X Mountain Lion OS X 10.8 Mountain Lion

MathEdit running on OS X Yosemite OS X 10.10 Yosemite

MathEdit running on macOS Sierra macOS 10.12 Sierra

MathEdit running on macOS Catalina macOS 10.15 Catalina

MathEdit running on macOS Sequoia macOS 15 Sequoia

NS is for NextStep

As Cocoa developers we always taught the NS in NSString, NSDictionary, NSArray, etc stands for NextStep. So I thought “What is it like to build an application for NextStep?” So I decided to try it! I got an OpenStep 4.2 Virtual Machine up and running, installed Project Builder (the precursor to Xcode) and got to work. MathEdit is the result.

Lessons Learned

The Good

OpenStep’s Foundation and AppKit frameworks are remarkable in that they are extremely complete even way back in 1996 (remember Mac OS X 10.0 Cheetah was released in 2001). If you ignore NIBs, then the code from OpenStep just works in OS X even to do this day. Yes, there are many deprecation warnings, but all of the API’s work without issue. And yes, it means NSApplication, NSTableView, NSWindow, NSButton, NSMenu, the responder chain, etc all work exactly the same as they do now.

The Bad

However, there is a lot of core functionality missing. Networking for example. NSData will download things for you when you give it an internet path, but this has all the pitfalls of modern NSData. Its single threaded, blocking, no progress, etc. If you want anything more than that you need to drop down to BSD Sockets. AppKit is missing basics like NSToolbar and NSDocument. Foundation is missing basics like NSError and NUSRL which kind of explains why there are all those duplicate methods with NSURL and NSString and with NSError and without NSError.

The Ugly

Lastly, there is the really hard stuff. Objective-C before “2.0” as Apple called it is pretty painful. That said, Objective-C 2.0 did not come to Mac OS X until 10.7, so thats pretty late in OS X history. But still, we are talking about the most basic features missing:

  • Automatic Reference Counting
  • Fucking Block Syntax
  • Property Syntax
  • Dot Syntax
  • Grand Central Dispatch
  • Collection Literals

The other major pain point is Nibs. While OpenStep Nibs do work in early versions of OS X, Apple had a bad habit of changing the Nib format, XIB format, and then just refusing to load older Nibs for security reasons over the years. Sp the only way to make an app that is compatible across history is to not use Nibs… and unlike on iOS, AppKit really does not like this. I spent a lot of time getting memory management to work properly in early versions of OS X that just ABSOLUTELY ASSUMED you were using Nibs. I did get it to work, but this was like days and days and days of research. Also, I had to learn the secret trick to set the Application Menu which did not exist in OpenStep.

Features

MathEdit is basically like Math Notes from Apple. Its a normal text editor like TextEdit, but if you type in a mathematical formula in the text, it automatically parses it and solves it for you. It makes extensive use of NSDecimalNumber and NSTextAttachment to do this. NSTextAttachment in particular is the star of the show. It still always shocks me that this was missing from iOS until iOS 7 even though it was in Mac OS X and even OpenStep before that. It is such a powerful way to enhance your text documents.

Caveats

I honestly don’t use MathEdit all that often. It is on all my Macs including my vintage ones and I think it is a cool proof of concept. But I don’t think its much more than that. But if you want to try it out for yourself, grab a build for your favorite Mac and give it a try.

https://github.com/jeffreybergier/MathEdit