13 comments

[ 4.2 ms ] story [ 32.0 ms ] thread
You can take ObjC from my cold, dead hands.

The cognitive burden of Swift is far too high for what it delivers, and it gets redesigned every year or two to be "different" than it was before, which makes finding example code online a challenge.

ObjC added about two dozen keywords to C and was rejected by the masses for use of [] insteqd of (). Is it really massively different to type:

   MyObject * object = [MyObject new];
rather than:

   MyObject * object = new MyObject;

Hell, you can even stretch to using property dot-syntax in ObjC:

   MyObject *object = MyObject.new;

It pretty much manages memory for you with ARC, the only thing you have to look out for being instance-loops where A retains B and B also retains A. It has closures (blocks) as a basic language type, and it is a true superset of C (unlike C++) so any C program will compile with the ObjC compiler. It also integrates with C++ for that matter.

Apple has invested too much in Swift for it to back down now, and I see some documentation is now Swift-only, not ObjC, so the writing is on the wall, but equally Apple has an enormous amount of internal code in ObjC, so it's going to be a long time before support goes away entirely.

And then, I'll just move to Linux. I've already written a basic implementation of a lot of the parts of Cocoa [1] with an SDL3 back-end, you even get GPU/compute shaders :) and although it's not ready for prime-time (the fit-and-finish needs some attention) it is the basis for me ultimately not needing to use Swift in future, a decade or so down the line, the bonus being that it'll work on anything - I have a proof-of-concept for it running on Windows, and GNUstep on Linux ought to make it easy to port there.

[1]: https://github.com/ThrudTheBarbarian/Azoth

I’m glad to see someone else that loves objective-c as much as I do. It is delightful.

It’s a fantastic language and tools. I wish it had had more time to polish, expand, and potentially grow beyond mainly Mac and iOS before swift happened.

I'm sort of with you. But we must be old. All the "kids" that came on board Apple as I was heading out loved Swift.

I liked Swift up until some of the "kids" started using esoteric features of it that bent my mind. I know from experience that everything that looks odd at first will, one day, become second nature.

But as I say, perhaps like me, you're old. Because I'm just getting a little tired of waiting for my bent mind to straighten out.

It was amusing reading the article. MPW, THINK Pascal, THINK C, Objective-C, Swift ... yep, over the nearly 40 years of my career I have known them all.

  "For I have known them all already, known them all:
  Have known the evenings, mornings, afternoons,
  I have measured out my life with coffee spoons;"
And also in all the ways to allocate and release memory.
More than just the language, with objc on mac you also get to take advantage of the surrounding stdlib. Toll-free bridging between CF and Cocoa, libdispatch which provides intuitive primitives for concurrency, etc. It's a shame that despite parts being open-sourced and GNUStep's efforts, there still isn't an easy way to get that "batteries included" experience.
Hear hear! I love Objective-C and just think it's the best language. I will use ObjFW going forward (and GNUStep as a last resort) once (if?) Apple drops ObjC, but so far it's still going strong.
> ObjC added about two dozen keywords to C and was rejected by the masses for use of [] insteqd of ().

Syntax matters. It's like the lesson Lisp people just refuse to learn: It's the parens, stupid.

One of the complaints people reach for about Scheme is that it has too many implementations. JavaScript has many implementations too: Node, Deno, Bun, all the browser ones, ES5, ES6, TypeScript... hell, at $JOB we actually have code written for Rhino. But people will transpile and polyfill till the cows come home to get the latest features into their struggling IE6 SPA. Scheme, people just shrug their shoulders and give up. Why?

One reason probably is, it's the parens, stupid. The near monopoly advantage that JavaScript enjoys over the browser-application space (and hence, virtually all front-end development) is probably a major factor, but then what about the back end?

I love Objective-C too. It came the closest I've ever seen to writing Smalltalk in an environment where applications are expected to be native and snappy. I've written a video game in it... for Linux. But Apple realized that for many devs, especially those getting onboard iOS development, the brackets would be a sticking point. Hence Swift.

    a = foo.bar();
    if(!a.frobnitz()) { return nil; }
If your language doesn't look like that, you will have an uphill battle. All successful new programming languages look more or less like this now, with the possible exception of Python. But Python's significant indentation actually helps beginners, data people, and others who don't sprinkle semicolons and curly braces on their Wheaties every morning.

Also, FWIW I don't think GNUstep has switched to Swift yet either, may wish to consider giving that a go.

ObjC was rejected by the masses due to requiring a GNU compiler, whereas regular C had dozens of compilers.

C became popular outside of Unix because of compilers from Microsoft, Borland and a couple others for the IBM PC compatible machines running MS-DOS. (And note that they introduced C++ compilers also!)

Of you coded in Obj-C in the early 1990s (the window of opportunity for C derivatives to become popular), you would have been using expensive, niche hardware like a NeXT cube or Unix workstation.

If Obj-C had been made to work PCs in in the 1987-1990 time frame, and work well, it could have been a different story.

I did iOS work around 2015-2016 and I really enjoyed ObjC. Didn’t mind the unusual bracket syntax at all. Especially loved protocols - they just made sense to my brain.
> It pretty much manages memory for you with ARC,

Objective-C added ARC relatively late, about 2010 or 2011 or so, and giving people a decade to stew with manual memory management isn't going to endear people to your language, especially when your competitors (C++, Java) have something, even if not great (the less said about std::auto_ptr, the better).

> ObjC added about two dozen keywords to C and was rejected by the masses for use of [] insteqd of (). Is it really massively different to type:

The square brackets are a vestige of Smalltalk, and it gives Objective-C a feeling of someone smashing Smalltalk into C and not really caring about the consequences. And it really doesn't help that Smalltalk itself had a pretty poor reputation by that point in time.

>GNUstep

How functional is this? It looks great but does not seem to get much use, is that just a popularity contest thing or does it have issues? Since it can compile any C code (up to what standard?) Does that mean we can mostly use C libraries? Are there issues with interfacing the C libraries with objc objects? Any good linux directed resources for learning objc/GNUstep?

You should check out Darling if you like Objective-C and Apple/macOS development. It is implementing a macOS translation layer on Linux. There is lots of work needed implementing Apple’s frameworks in Objective-C.

https://www.darlinghq.org/

As I recall, the "official" language of early Mac development was Pascal - just normal Pascal, not any of the OOP extensions like Clascal or Object Pascal. All of the documentation in Inside Macintosh assumed you were using Pascal, and most Toolbox routines took Pascal strings (one byte length + up to 255 characters) as arguments. But none of it used any OOP features - it was all entirely procedural.