[swift-dev] What can you change in a fixed-contents struct?

Slava Pestov spestov at apple.com
Tue Sep 5 17:14:10 CDT 2017


> On Sep 5, 2017, at 1:01 PM, David Zarzycki via swift-dev <swift-dev at swift.org> wrote:
> 
> Hi Jordan,
> 
> Thanks for thinking about this. For whatever it may be worth, I’m concerned about 1) the ability to reorder declarations and 2) the “either/or” nature of this proposal.
> 
> First, reordering: The ability to reorder declarations is deeply ingrained into the subconsciousness of Swift programmers and for good reasons.

There are a couple of other places where ordering of declarations matters in the ABI. The two most important ones I can think of right now are virtual methods and protocol methods. Both are called by performing an indexed lookup into a vtable. For methods, we were thinking that the ordering should first sort by availability annotation, and then by the mangled name of the method. This would allow re-ordering as well as adding new methods, as long as they had a ‘newer’ availability than anything that has come before.

However, I like the idea of an @_abi (or similar) attribute as an escape hatch of some kind, in case we screw something up.

Slava



More information about the swift-dev mailing list