Hacker News new | past | comments | ask | show | jobs | submit login

Those who don't understand Objective-C are bound to reinvent it...badly.

"... you could even use the generated API with Lua, Python, Ruby or JavaScript"

Guess what, all these have Objective-C bridges, usually multiple ones, because the combination of being just a thin shim on top of C as well as that thin shim being essentially a Smalltalk with full dynamic messaging and runtime introspection + intercession means interop is Objective-C's bread and butter.

No C code generation required.

This should be no surprise because that was exactly the stated goal of Objective-C, and they achieved it admirably. If you think Objective-C is a closed, vendor-specific language like Swift, you truly don't understand it. At all.

Someone once described Objective-C as "COM with language support" and that's pretty accurate.




> Guess what, all these have Objective-C bridges, usually multiple ones, because the combination of being just a thin shim on top of C as well as that thin shim being essentially a Smalltalk with full dynamic messaging and runtime introspection + intercession means interop is Objective-C's bread and butter.

Exactly.

In fact sometimes in lieu of shell scripts I write simple utility JavaScript files using Objective-C APIs and run them under osascript.

For Python, the easiest way to copy a file while not using twice the disk space (using reflinks) is still using the Objective-C API: https://github.com/RhetTbull/osxphotos/blob/20ef78bbd45a6787...


Can you explain the JavaScript api more? Are you talking about a webView or something else.

Edit: oh I see what you are talking about. The osascript aspect was what I wasn’t getting.


As an example, I had a utility (since no longer necessary) that removes files from Trash after a while: https://gist.github.com/kccqzy/8dbead563afdcd6a491a

I couldn't write it as a shell script because I wanted to get the "date added" rather than the "date modified" or "date created" but this is available in Cocoa APIs.


> Someone once described Objective-C as "COM with language support" and that's pretty accurate.

That is what VB6, Delphi, C++ Builder and .NET Native do (yes not that much relevant nowadays).

If anything I would describe that Objective-C is a better COM, which isn't quite the same.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: