Dale Buckley

@dlbuckley
10 Followers
60 Following
25 Posts
I make computers dance, show two mini humans the world, and occasionally throw myself down snowy mountains 🇬🇧

Bare-metal Raspberry Pi Pico entirely in Swift, no C code at all. Vector table, boot2, startup code, runtime stubs, all written in Swift using @\section, @\_extern, and @\c.

https://github.com/kishikawakatsumi/pico-bare-swift

@simsaens same! It’s a bland blue icon in a sea of other bland blue icons.
Bugs Apple Loves

Bugs Apple won't fix. Why else would they keep them around for so long? We did the math.

Your favorite C library, now with Swift superpowers. 🦸

New post: how to transform C APIs into idiomatic Swift, with enums, automatic reference counting, and argument-labeled methods. Best of all: no header changes needed, thanks to API notes! 🥳 https://www.swift.org/blog/improving-usability-of-c-libraries-in-swift/

Improving the usability of C libraries in Swift

There are many interesting, useful, and fun C libraries in the software ecosystem. While one could go and rewrite these libraries in Swift, usually there is no need, because Swift provides direct interoperability with C. With a little setup, you can directly use existing C libraries from your Swift code.

Swift.org

Got unreasonably excited about this new, incredibly straightforward count-distinct algorithm. The CVM algorithm is a direct replacement for HyperLogLog, it nerd-sniped Donald Knuth for weeks, *and* it can easily be taught in an entry-level CS course.

h/t @munin
https://www.quantamagazine.org/computer-scientists-invent-an-efficient-new-way-to-count-20240516/

Computer Scientists Invent an Efficient New Way to Count | Quanta Magazine

By making use of randomness, a team has created a simple algorithm for estimating large numbers of distinct objects in a stream of data.

Quanta Magazine
DHH Is Way Worse Than I Thought | jakelazaroff.com

DHH's politics are not normal. Maybe they used to be, I don't know, but as of right now the dude is way outside of what most people would consider moral or acceptable.

🧪Exit testing is new in Swift 6.2! Now it's easy to check whether code exits cleanly, and ensure it prints the expected output to the console. Here's a sssssuper sssssimple sssssample! 🐍 More at https://developer.apple.com/documentation/testing/exit-testing
Apple Turnover

TIL about the existence of git worktrees. I’d been using stash for so long I’d never considered there was another option.
@twostraws @mikaelacaron @swiftovercoffee I once tried to use embedded Swift on a raspberry pi pico using Windows. I ended up with a Frankenstein setup where I had to build through a docker container with a shared directory which I opened in VSCode on the windows host machine which then auto uploaded the binary to the pico. Not the most ideal, but it worked!