Showing posts with label Software. Show all posts
Showing posts with label Software. Show all posts

Wednesday, June 7, 2023

Mojo is a much better "Objective-C without the C" than Swift ever was

One of the primary things that people don't understand about Objective-C is that it is a solution of the two language problem, or more precisely a generalisation of the two language problem to the scripted component pattern.

The scripted component pattern itself is a (common) solution to the problem, first identified in the 70s that programming-in-the-large is not the same as programming-in-the-small, that module implementation languages are not necessarily suitable as module interconnection languages.

And so we have all sorts of flexible connection languages, often interpreted (aka glue, scripting, and orchestration languages), starting with the Unix shell, in addition to fast, compiled component languages such as C, C++ and Rust, and a system will usually incorporate at least one of each kind.

But then you run into the two language problem: you have to deal with these two distinct languages, with how they integrate, and with the boundaries of the integration often not matching up very well with the boundaries of the problem you're trying to solve.

Objective-C solved the two language problem by just jamming the two languages into one: Smalltalk for the scripting/integration and C for the component language. Interoperability is smooth and at the statement level, thougha there is some friction due to overlaps caused by integrating two existing languages that were not designed to be integrated.

Mojo essentially uses the Objective-C approach of jamming the two languages into one. Except it doesn't repeat Objective-C's mistake of using the component language as the base (which, inexplicably, Swift didn't just repeat, but actually doubled down on by largely deprecating objects). The reason this is a mistake is that it turns out that the connection language is actually the more general one, the component language is a specialisation of the connection language.

With this realisation, Mojo's approach of making the connection language the base language make sense. In addition, the fact that the component language is a specialisation also means that you don't actually need to jam a full second language into your base, a few syntactic markers to to indicate the specialisations are sufficient.

This is pretty much exactly stage 2 of the 4 stages of Objective-S, so I think they are using exactly the right approach for this. Except of course for the use of Python as the base instead of Smalltalk, which is a pragmatic choice given what they are trying to accomplish, but means your connection language is unduly limited.

Objective-S has the same basic structure, but with a much more capable connection language as the base.

Friday, January 13, 2023

Setting the Bozo Bit on Apple

The other day I was fighting once again with Apple Music. Not the service, the app. What I wanted to do was simple: I have some practice recordings for my choir and voice lessons that I want on my iPhone and Apple Watch. How hard could it be?

Apple: hold my beer.

These are sent via WhatsApp so the audio recordings are mp4 files, which for some bizarre reason won't open in Music and instead open in QuickTime Player, despite definitely being audio files.

OK, not a biggie, so export to m4a from QT Player. Transfer to the machine that has my audio library. Create a new playlist, transfer some previous songs over, then try to drop the new m4a's onto the open playlist. No go. Play around for a while, figure out that the entity that accepts the drops is the TableView, not the surrounding view. So you can't drop the new files into the empty space below the songs, you have to drop them onto the existing songs.

Who programmed this? Who didn't pay attention to this when doing QA? Who approved it for release? iTunes used to be if not the, then certainly a flagship app for Apple.

OK, plug in the iPhone, as for some reason wireless transfers don't seem to be overly reliable.

No Finder, I don't want to back...too late. Ok, do your backup. Waiting. Spinner. Waiting. Repeat. After a while it says it's finished. Unplug and ... the songs are not there.

I quit Music.app, relaunch it, and lo-and-behold, the songs are now no longer in the playlist in Music.app either. Re-add them, carefully aiming for the table, sync again (hey, it remembered we just did a backup and doesn't try again, kudos!), and now they show up.

Whew! Only took 15 minutes or so, the last time I was futzing with it for over an hour and the songs never synced. Or one did and two did not, which is obviously Much Better.

How can such basic functionality be this incredibly broken? And of course this is just one tiny example, there are legions others, as many others have reported.

With this, I noticed that I hadn't actually expected better. I knew it should be better but I hadn't expected Apple to actually make it work.

In other words, I had set the Bozo Bit on Apple. By default, when Apple does something new these days, I fully and quietly expect it to be broken. And I am surprised when they actually get something right, like Apple Silicon. And it wasn't an angry reaction to anything, in fact, it wasn't even much of conscious decision, more a gradual erosion of expectations.

It Just Doesn't Work™.

And that's sad.