Last Week on My Mac: From assembly to Shortcuts

It has been a week of extremes. As the Pacific north-west and other parts of the US have been sweltering, many folk here in the UK have been turning their domestic heating back on. So it was on Wednesday that I was exploring coding in assembly language, and by Friday looking at Monterey’s new Shortcuts automation app.

Assembly language takes me back to my computing roots, when I was looking at harnessing the power of the first maths co-processors, and started my gradual ascent through progressively higher-level languages until I reached the likes of APL, and most recently Swift. It’s puzzling how little has changed over those thirty-odd years, though, with almost every productivity feature in Xcode absent the moment you turn to editing a little assembly code.

There’s no automatic formatting, syntactic colouring or other aids, and for a while you might wonder whether you’d be better off using a classic Unix editor like vi or emacs. Xcode’s Help book pretends that assembly language doesn’t exist, and so far I’ve even been unable to identify which assembler is being used and its support, if any, for macros. Look for coverage of ARM assembly language in any WWDC, and the closest I’ve come is WebAssembly.

Yet coding in assembly language is a fundamental skill across so much of computing, and always will be. Unless you understand how to get processors to do what you want of them, so much will remain shrouded in mystery. For some groups, security researchers in particular, being able to read assembly language is an essential skill, and just like regular reading, that’s strengthened by being able to write it as well. My own motivation is to look at floating point performance, not just in terms of sheer speed, but cumulative error too. While I have enormous respect for the code-generation of Apple’s Swift compiler, there are times when it may pay to optimise your code by hand, and I want to discover whether that’s still worth the effort.

At the opposite end of the coding spectrum, Shortcuts and automation were all the rage earlier this month, with Apple’s Developer app offering me no less than 32 videos and five articles which keep telling me how they help people to get things done quickly. As discussion has shown here, reception isn’t all as enthusiastic as press reports. While there’s no doubt that Shortcuts has become very popular on iPhones and iPads, the way that we interact with Macs is very different, and the tasks we want to automate are often more complex.

Cast your mind back before Mac OS X, which introduced the TextEdit app, and you may recall its predecessors: SimpleText, which first came with System 7.1.2, its predecessor TeachText, and the original Edit app. SimpleText was used by Apple to demonstrate how apps like styled text editors could support AppleScript, and I remember being how impressed I was with a fully scriptable text editor, which could even record its own scripts from a sequence of user actions. So far, demonstration code for Shortcuts shows how it can be used to order soup, and to help the user with their bedtime intents, tasks for which few Mac users are likely to call on automation tools.

If bringing Shortcuts to macOS is of less than obvious value, one change which we shouldn’t underestimate comes in Swift Playgrounds 4 for iPadOS: the ability to build apps on an iPad, and to submit them to the App Store. I started to switch to Swift when I grew frustrated with the limited access to macOS provided by AppleScript, and have pointed out how it’s often quicker and easier to code a more polished app using Swift and AppKit than it is to use AppleScript. While Apple hasn’t (yet) announced that the next macOS version of Swift Playgrounds will also be able to build apps, I’d be most surprised if that isn’t already in development.

The prospect of our Macs offering everything from assembly language to Swift Playgrounds, and from AppleScript to Shortcuts, must excite every user and coder regardless of their ability and language. Although I’m confident that assembler will still be among the survivors in five years time, it remains to be seen which of the others will prove as durable.