[swift-dev] What can you change in a fixed-contents struct?
David Zarzycki
zarzycki at icloud.com
Tue Sep 5 17:26:05 CDT 2017
> On Sep 5, 2017, at 18:14, Slava Pestov <spestov at apple.com> wrote:
>
>
>> 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.
Ya, given how vtables work, the ABI is essentially API once ABI-stability matters. Having something like "@_slot() func” and "@_slots() class” would also yield a nice “belt and suspenders” approach for those people that want to enable ABI stability on a given declaration. If anything, given how many methods exist on classes and the strong desire to reorder methods, the “@_slot()” attribute would be really nice.
Dave
More information about the swift-dev
mailing list