Live data from Hacker News

Ask HN: How many of you Apple developers still use Objective C?

news.ycombinator.com

81–90 of 160 posts

Re: Ask HN: How many of you Apple developers still use Objective C?

#81
post #76

Earlier quoted context omitted.

> If you find yourself enjoying ObjC, by all means keep using it. Or C. I didn't say I enjoyed ObjC. That's not really how I choose my tools. It's a job. The choice is utilitarian. > Or Pascal. I seem to recall enjoying Pascal somewhat, though that was a very long time ago. > Or Lisp. I definitely recall not enjoying Lisp. Not at all. Yuck. > that doesn’t account for extra-hours and bugs it takes to get there. If Swi…

> I didn't say I enjoyed ObjC. That's not really how I choose my tools. It's a job. The choice is utilitarian. Given C is faster and more mature than ObjC, why aren’t you writing everything in pure C and objc_msgSend?

> Given C is faster and more mature than ObjC, why aren’t you writing everything in pure C and objc_msgSend?

TBH your question feels trollish, but I'll respond anyway.

Objective-C code does compile to objc_msgSend calls. Perhaps you meant getting the method implementations directly and calling them instead?

Objective-C is 40 years old. How much more mature does it need to be?

Re: Ask HN: How many of you Apple developers still use Objective C?

#82

Earlier quoted context omitted.

After years of obj-c I wrote a rather larger app on Swift 1.1. I'll never forget the pain of upgrading to each new version of Swift. And my god, the pain of early swift string manipulation. 100% technical debt annually.

If there’s one lesson to take from Swift 1 and 2, it’s that Apple is comfortable launching beta APIs that can undergo massive churn. It’s why I avoided SwiftUI for the first few years, and now why people would be wise to do the same for SwiftData.

Same with Google. When they announced that Compose was now "stable" I laughed out loud and said "they just slapped a 1.0 version on it, didn't they?". And yes they did. We're a lot of releases later and it's still no fun to debug weird-ass issues. Last week I had two textfields, and both of them had focus at the same time!

Re: Ask HN: How many of you Apple developers still use Objective C?

#83
post #81

Earlier quoted context omitted.

> I didn't say I enjoyed ObjC. That's not really how I choose my tools. It's a job. The choice is utilitarian. Given C is faster and more mature than ObjC, why aren’t you writing everything in pure C and objc_msgSend?

> Given C is faster and more mature than ObjC, why aren’t you writing everything in pure C and objc_msgSend? TBH your question feels trollish, but I'll respond anyway. Objective-C code does compile to objc_msgSend calls. Perhaps you meant getting the method implementations directly and calling them instead? Objective-C is 40 years old. How much more mature does it need to be?

You said you make the utilitarian choice. By using C everywhere, you can use an even faster compiler that doesn’t insert those calls for you. So why don’t you?

Re: Ask HN: How many of you Apple developers still use Objective C?

#84

My codebase contains a lot of Objective-C but I'm slowly replacing it with Swift. I rarely write Objective-C (largely because it's so easy to introduce bugs with release/retain shenanigans) unless I really have to. Interoperability between the languages does work but is fragile, with Xcode often getting into a chicken-and-egg state where a compilation error in Swift prevents the Objective-C from compiling, and vice v…

…are you maintaining a pre-ARC code base or something? Retain and release shouldn’t be that big of an issue otherwise.

Re: Ask HN: How many of you Apple developers still use Objective C?

#85
post #40

I've been writing Objective-C recently to use macOS frameworks from Rust. I can just write C wrapper functions and compile as a static library. Otherwise I use Swift.

No objc macro? I still use that for cacao and it mostly “just works”.

Re: Ask HN: How many of you Apple developers still use Objective C?

#86
post #81

Earlier quoted context omitted.

> Given C is faster and more mature than ObjC, why aren’t you writing everything in pure C and objc_msgSend? TBH your question feels trollish, but I'll respond anyway. Objective-C code does compile to objc_msgSend calls. Perhaps you meant getting the method implementations directly and calling them instead? Objective-C is 40 years old. How much more mature does it need to be?

You said you make the utilitarian choice. By using C everywhere, you can use an even faster compiler that doesn’t insert those calls for you. So why don’t you?

> By using C everywhere, you can use an even faster compiler that doesn’t insert those calls for you.

In the previous comment you said I should use objc_msgSend, now you say I shouldn't. Make up your mind. ;-)

Anyway, I'm using AppKit and UIKit to write apps. The API is Objective-C. That's why I write Objective-C.

Whatever the heck you're talking about—you appear to be confused, so I don't know what exactly you mean technically—it certainly sounds like premature optimization, which is a waste of time and not the correct utilitarian choice. My Objective-C code is not "slow". Could it be infinitesimally "faster" in way that's not even perceivable by the user? Perhaps, but who cares?

Re: Ask HN: How many of you Apple developers still use Objective C?

#87
post #17

I use Objective-C exclusively (no Swift) in my App Store apps. I wrote a Swift app for a hobby/free project a few years ago and regretted it. They changed the language and deprecated some of my code, which isn't easily replaceable without a significant rewrite. The project now compiles only in Swift 4 and will die when Swift 4 support is removed from Xcode. I see no reason to use Swift. The compiler is slower and bug…

> C interoperablity, while it exists in Swift, can be very painful Interesting, that hasn't been my experience. I'm curious, what have you ran into that was painful?

If I recall correctly you have to make a separate module with the bridging headers, but the first problem is that I can't remember exactly of the syntax of that file.

The second is that it's a lot of code and files to make when we only have one import to hack something quickly. For a full library it's probably a very cool feature though.

The third one is more related to my use case. I made a binding with a non-C codebase, and Swift cannot directly import C functions AFAIK, so I had to write C code in addition to the Swift one to make headers. It's not impossible, but it does take time to write all of that in a third programming language.

The fourth problem is related to library imports. In SPM, you either import a system library, or an xcframework. If your app targets any non-Apple platform, xcframeworks are not an option, so if you made a binding to your own lib that's annoying as it is probably not installed while you're building. And even if you're targeting Apple platforms, making an xcframework without Xcode is not well documented.

I probably missed a few problems as my experience is not very extensive, and there are probably better ways to achieve some of the things I wanted to do, but there isn't much documentation about all of that online anyway as far as I saw.

Re: Ask HN: How many of you Apple developers still use Objective C?

#88
post #17

I use Objective-C exclusively (no Swift) in my App Store apps. I wrote a Swift app for a hobby/free project a few years ago and regretted it. They changed the language and deprecated some of my code, which isn't easily replaceable without a significant rewrite. The project now compiles only in Swift 4 and will die when Swift 4 support is removed from Xcode. I see no reason to use Swift. The compiler is slower and bug…

former Mac dev here, and completely agreed. Refactoring an app because someone else decided to change the language is a bridge to far. And if they do it this time, they'll do it again. Meanwhile the ObjC compiles.

--- Rant - With Swift Apple shifted dev power to themselves. Having gotten fat on the open world, they've backed away from every 'Open' technology they can, and replaced it with their own, ( presently all the way to CPU architecture). Yes, they are giving tremendous powers, but have they also crafted the One Ring.

Re: Ask HN: How many of you Apple developers still use Objective C?

#90
post #35

I've given up on Apple platform development, but I strongly prefer Objective-C over Swift for a variety of reasons, including elegance, compatibility, stability, etc. It's important to note that there's still tons of Objective-C written inside Apple to this day, perhaps more than Swift. What Apple pushes as what you should be using is often not what they are using internally, FWIW. Third-party developers are its true…

You could probably say the same about most large public orgs. For instance many Amazon teams don't even use modern AWS internally for their services. At least as of three years ago.
Post reply on HN