[swift-evolution] Philosophy of Swift

Paul Cantrell cantrell at pobox.com
Wed Jun 8 18:21:56 CDT 2016


On Jun 8, 2016, at 6:13 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> 
> on Wed Jun 08 2016, Paul Cantrell <swift-evolution at swift.org> wrote:
> 
>> The interplay of the first two and the last two is what makes the
>> language unique. For example, structs have a simple, high-level
>> programmer model — “pass by value semantics” — but the compiler jumps
>> through all those COW hoops to make them perform _most_ of the time as
>> if they were C structs statically allocated and then passed by
>> pointer.
> 
> I have no argument with most of what you wrote, but this part is just
> inaccurate.  Plain structs are never CoW'd, and the compiler doesn't
> introduce CoW.  The standard library implements CoW “manually” for
> specific types like Array and String. 

So then only language/runtime magic is isUniquelyReferenced(), and all the other “hoops” are in the standard lib?

I guess I just lump compiler and standard library together in my mind too carelessly!

P



More information about the swift-evolution mailing list