|
|
Log in / Subscribe / Register

Rustaceans at the border

Rustaceans at the border

Posted Apr 25, 2022 5:34 UTC (Mon) by ras (subscriber, #33059)
In reply to: Rustaceans at the border by nix
Parent article: Rustaceans at the border

> cunning Swift tricks

Is there anywhere I can read about what these cunning Swift for generic are?


to post comments

Rustaceans at the border

Posted Apr 25, 2022 10:54 UTC (Mon) by mathstuf (subscriber, #69389) [Link] (3 responses)

There was an article that seemed to be by one of the devs that I had read, but I can't find it anymore (Firefox seems to expire history now…). Here's one I found that describes it; it may have a link to the "original" I'm thinking of.

https://gankra.github.io/blah/swift-abi/

Rustaceans at the border

Posted Apr 25, 2022 22:00 UTC (Mon) by ras (subscriber, #33059) [Link] (1 responses)

That was a good read.

Nothing particularly remarkable in how it's done. Generous use of vtables, thunks converting parameters by coping them, putting the return value on the heap. (I wonder if they considered a separate return value stack?) Thunks in vtables is novel - I haven't seen that before

But mostly it's stuff we've all done manually at some point. Android's compatibility libraries are the same thing done manually, on steroids. Is the major difference is seems to be Swift does it by default, making it automagic it with some nice tooling?

Rustaceans at the border

Posted Apr 26, 2022 13:03 UTC (Tue) by nix (subscriber, #2304) [Link]

Exactly. Because it's automatic it's everywhere. If it's only done manually you end up with only a few foundational libraries with stable ABIs, and an ecosystem that more or less doesn't use shared libs at all. If it's automatic you get pervasive sharing.

Rustaceans at the border

Posted Apr 26, 2022 13:01 UTC (Tue) by nix (subscriber, #2304) [Link]

That's the one I was thinking of too but for some reason couldn't find anywhere in my browser history. Thanks!


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds