5 ms·
I wish Swift focused on reference semantics. One of the big problems of value types in C++ is that you have to be a language lawyer to not accidentally make was
by gurkendoktor 9y ago
I wish Swift focused on reference semantics. One of the big problems of value types in C++ is that you have to be a language lawyer to not accidentally make wasteful copies of everything, and the same is true of Swift:
http://rosslebeau.com/2016/swift-copy-write-psa-mutating-dictionary-entries http://rosslebeau.com/2016/swift-copy-write-psa-mutating-dic...
I thought Objective-C had already solved this problem quite nicely with the explicit NSFoo/NSMutableFoo class pairs. I don't see why this needed to be fixed again, in a less explicit way.
- bushin 9y agoThey are trying to address that https://github.com/apple/swift/blob/master/docs/OwnershipManifesto.md https://github.com/apple/swift/blob/master/docs/OwnershipMan...
- catnaroek 9y agoThe conflation of values (which exist in the language's semantics on paper) with physical representations (which exist in computer memory) plagues most imperative languages that try to do value semantics.
- kjaleshire 9y ago> One of the big problems of value types in C++ is that you have to be a language lawyer to not accidentally make wasteful copies of everything... Not always. The C++ standard has allowed copy elision for some time [1]. Guaranteed copy elision for certain forms of copy has been proposed for C++17 [2]. [1] http://en.cppreference.com/w/cpp/language/copy_elision http://en.cppreference.com/w/cpp/language/copy_elision [2] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0135r0.html http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p013...