[swift-evolution] Does protocol support add to an object's size?

Daryle Walker darylew at mac.com
Fri Mar 31 11:33:44 CDT 2017


> On Feb 15, 2017, at 3:36 PM, Slava Pestov <spestov at apple.com> wrote:
> 
> Values of concrete type always have the same size regardless of what protocols the type conforms to.

So, two struct types with the same instance-level stored properties, but one with no protocol conformance and the other with at least one, have the same stride-of? Does that mean that the latter type keeps no per-instance space for protocol support? Or that all struct types keep protocol accounting information, even when a struct’s protocol list is empty (like the former type)?

>> On Feb 15, 2017, at 9:51 AM, Daryle Walker via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> I don't know how protocol support works. I asking because I want to maintain the stride of an array being the total count times the stride of the element, which would complicate nominal arrays if adding protocols to one breaks that. 

— 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com 



More information about the swift-evolution mailing list