Live data from Hacker News

C-Macs – a pure C macOS application

github.com

21–30 of 138 posts

Re: C-Macs – a pure C macOS application

#21

Earlier quoted context omitted.

I’d say the license is: “ Use it at your own risk, and don't blame me if anything bad happens. Oh, and if you extend it, make sure there isn't any Objective-C in it!” I’d classify it as Open Source.

I do love the vibe of that license

If it weren't for it claiming to not be a license in the sentence before, it would be pretty good. Reminds me of the WTFPL license. :)

https://directory.fsf.org/wiki/License:WTFPL

Re: C-Macs – a pure C macOS application

#22

Earlier quoted context omitted.

MacOS apps are typically written in either Objective-C or Swift as these are the officially supported languages for the MacOS APIs. The code in this template is interfacing with the Objective-C runtime but with pure C.

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.

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...

Re: C-Macs – a pure C macOS application

#24
post #14

Earlier quoted context omitted.

Oh no that won't fly at all. People around here really like "proper" licenses. And they'll tell you about it.

I don't like the (perhaps actually a) license, because it set's limits on what the user can do with the source code. (Not allowing Objective C in it.)

yeah i accidentally added objective c code and now im kissing my ass bracing for the lawsuit!!!!!!!111

Re: C-Macs – a pure C macOS application

#26
post #6

As someone with no experience in native application development, could someone explain to me why this is significant? I have a rough idea, but I would like to understand it properly.

> why this is significant?

Ultimately, because new people keep being born and missed the years where this was pretty common and haven't yet bumped into the corners where it still is.

The repo and the SO discussion it was inspired by are themselves 11 years old and seem to be rooted in a new generation of iOS app developers starting to get more deeply curious about the system they're running on and how else it might be approached, which this person then ran with on MacOS.

Apple invites people to get started in making software for their platforms using (what's meant to be) more accessible tooling like Objective-C, Interface Builder, Swift, SwiftUI, etc but there's of course a whole BSD-rooted operating system sitting there once those those developers start digging. It's no secret, but it's a discovery that some people need to make on their own.

Re: C-Macs – a pure C macOS application

#27

Earlier quoted context omitted.

MacOS apps are typically written in either Objective-C or Swift as these are the officially supported languages for the MacOS APIs. The code in this template is interfacing with the Objective-C runtime but with pure C.

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.

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

Re: C-Macs – a pure C macOS application

#28
post #7
post #6

As someone with no experience in native application development, could someone explain to me why this is significant? I have a rough idea, but I would like to understand it properly.

I guess it's normally impossible to write a GUI application for mac os without objective-c libraries doing the talking to the OS, but what do I know.

It is not. This was just a new wave of people finally looking under the hood.

(Where they would have found many many dusty but detailed man pages and docs waiting for them)

Re: C-Macs – a pure C macOS application

#29
post #6

As someone with no experience in native application development, could someone explain to me why this is significant? I have a rough idea, but I would like to understand it properly.

It's an exercise in recreating how an Objective-C app works in C from first-principles. For example, the creation of the AppDelegate (see CreateAppDelegate() in AppDelegate.c) is interesting because it shows how to create a class from NSObject and attach the applicationDidFinishLaunching: method along with it's implementation in C. I've used objc_msgSend() before from C (to access the pasteboard from a CLI app), but never implemented any ObjC classes using C!

It's similar how you might attempt to build a C++ class from only C components by creating a vtable.

Re: C-Macs – a pure C macOS application

#30

I did a straight C++ app for MacOS but 1) I used SDL2 and 2) it was a full-screen game so no Cocoa UI needed. It was kind of fun though in a retro-computing way. (I'm a big fan of SDL now.)

The linked project doesn't use any ObjC files at all. SDL2 has a bunch of Cocoa files[1] so you did use Cocoa even if unknowingly.

[1] https://github.com/libsdl-org/SDL/tree/main/src/video/cocoa

Post reply on HN