Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That has always been possible. Also, under the ObjC layer, is good ol' ANSI C (FreeBSD Unix).

There's a number of apps that run on modern Macs, that were written in C, but it is unusual to see ones that leverage the GUI.

That said, it's possible to walk from Boston to Portland (OR), but I'd rather take a plane.




I knew this was possible, but I had never actually seen it implemented before. And to think, the project is over 10 years old!

When I first started programming Cocoa, I was always kind of miffed that the happy-path was: "Use Objective-C and main() should just hand-off the reigns to NSApplicationMain()". Kind of like the happy-path on Windows is "WinMain plus a bunch of boilerplate crud".

It's always felt somehow vaguely "correct" to have main() be your actual application entry point and have it manage whatever main loop you need yourself. I see that this project doesn't actually quite get there either. It's the same kind of voodoo: boilerplate code, and then cmacs_void_msgSend(NSApp, sel_getUid("run")); hands over the reigns.


I agree. I recall the Windows API and the official Hello World. I'm sure they could have got to the same place in a slightly reorganised way that kept main() as the starting point and interfaced with the event loop and the entire windowing system via some API calls that hid the cruddiest parts of the boilerplate crud (apt phrasing, thank you) away in headers and libraries. Then progressively reveal the details when they're really necessary for more elaborate applications.


It has to hand over the reigns to the Objective-C runtime to allow for all the messages being passed between objects.

I’m not sure you want to spend your time rewriting what NSApp is doing!


The runtime knows how to do that already. -[NSApplication run] sets up the runloop to drain events among other things.


Why would you want to manage your own runloop? It's both not interesting and possible to get wrong.


Sometimes there are conflicting things you need to do in the same main thread.


You know i took the train to Boston to PDX, it was really relaxing. Not quite walking but definitely a lot different then a plane...


It has, but there was also Carbon until around the Intel transition.


Full Carbon was there until the 64bit transition officially, but much of it remained and still remains until now. For example, Apple only started using AppKit to draw menus in Sonoma; it was Carbon until now.


I think it’s cool that a lot of NextStep stuff is still there (all those “NSXXX” calls).


Wait until you see the NX* APIs ;)


Quick! The one comment where my username is relevant! Must... reply... before.. opportunity... passes...


I have not encountered them. Are they public?





Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: