Hacker News new | ask | show | jobs
by SneakerXZ 647 days ago
> Swift use value-types by default with copy-on-write semantics.

This isn't true. Copy-on-write semantics are implemented only for arrays, dictionaries, and strings. Swift value-types are copied immediately.

https://docs.swift.org/swift-book/documentation/the-swift-pr...

1 comments

The documentation uses “copied” for value types that are copy-on-write.

The documentation has oversimplified a bunch of the mental model and it causes incorrect understanding.

Swift’s documentation is quite bad TBH. The biggest thing that still needs to be improved a lot.