Hacker News new | past | comments | ask | show | jobs | submit | lukeh's comments login

Page 36, very droll.

Windows having multiple C libraries has its own pain points, in particular it's difficult to ship binary libraries that return allocated memory to their consumer (you either need to have the library consumer allocate the memory, which probably explains why so many Win32 APIs have this behaviour, or allow alloc/free functions to be registered). Not to mention different C libraries having their own file handle, TLS, etc state. Unsurprisingly Microsoft now ships the Universal CRT (UCRT) as part of Windows.


Having consumer allocate the memory where possible has other benefits in that the consumer can use more efficient allocation techniques (stack, arenas etc), and given that Win32 API design goes all the way back to the earliest version of Windows running on very resource-limited PCs, that would be the main reason why.

However, in cases where this wasn't consistently feasible - e.g. COM - Windows instead mandates the use of a common API to manage memory: CoGetMalloc etc.


Things I like about Swift: works great on Linux, fun to write in, excellent interoperability with C, C++ and even Java.

Thinks I like less: compile times, binary size, runtime type introspection overhead (Codable performance was killing our application), getting async/await right (still that's always going to be hard whichever way you slice it).


More and more, and Foundation is now sharing a codebase between Darwin and non-Darwin platforms for many types now.


https://www.timebeat.app/

Also making some very nice stuff at great price points.


Are they great price points? Their open timecard starts at £2,999 or £5,495 with an atomic oscillator. Those prices are far outside the home hobbyist budget.


Just FYI to the article, more recent versions of CF are available as part of swift-corelibs-foundation.


They're newer, but they aren't at all similar to what ships on Apple's OSes anymore. These days, the layers have flipped, and CoreFoundation is becoming a wrapper around swift-foundation.

CF functions toll-free bridge the CF types to their Foundation counterparts and invoke the corresponding Objective-C API, which is either implemented directly in Swift, or is a wrapper around the Swift function.

An Apple employee on the Foundation team posted an example of how calling `CFCalendarCreateWithIdentifier` works here: https://forums.swift.org/t/swift-foundation-now-available/73...

I'm sure it's still a work-in-progress, but their definitive goal is for the OSS swift-foundation codebase to be the same as what ships in their OSes, which was never the case with swift-corelibs-foundation.

Edit: I found a conference talk by some Apple folks that goes into more detail https://www.youtube.com/watch?v=wn6C_XEv1Mo


swift-foundation will never be the code that ships on the OS, mostly because they always have some private bits they won't expose. Come back when URL bookmarks are part of the open source dump.


Of course the entire binary will never be the same, but the implementation of (for example) DateComponents.swift in OSS swift-foundation will be the same implementation that is used to build the OS library.

Going forward, the bedrock of both the OSS package and the platform [Core]Foundation.framework will be swift-foundation. This is distinct from SCF, which was a novel Swift wrapper around CoreFoundation.


The code in CoreFoundation.framework was basically built out of that repo, though.


Sure, but that’s not relevant in the timeline of the OP.


Sun paid an absolutely fortune for Cobalt if I remember right!


Swift can be just as fast as C or C++. The danger, in my experience, is that it's not always clear what the performance implications of the language's many convenient abstractions are. (A random example, I recently improved one code path by over an order of magnitude by replacing some serialisation that used Codable with hand-rolled code. Still 100% Swift, just paid a lot of attention to avoiding RTTI and allocations.)


Also Yocto supports systemd. I’m using it in my build.


I just use git submodules because, whilst they can be frustrating, it's a workflow I'm familiar with. Other options would be kas or gclient.


Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: