[swift-users] Are value semantics really appropriate in a diagramming app?
jackl at apple.com
Mon Aug 1 21:18:47 CDT 2016
Jens: Why? There are significant benefits to value semantics for this type of problem, for the reasons laid out in the WWDC videos. It would be helpful to know why you disagree in this case—maybe there are solutions to the issues you’re thinking of.
Rick: I’d think that value semantics would be the right choice here. When you do a mutation, you would copy the state of the entire diagram. It should be efficient via COW, but if not you can implement you own more fine-grained COW types with isUniquelyReferenced(). This would allow you to easily support things like undo.
> On Aug 1, 2016, at 4:32 PM, Jens Alfke via swift-users <swift-users at swift.org> wrote:
>> On Aug 1, 2016, at 1:19 AM, Rick Mann via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>> wrote:
>> It seems like reference semantics are more appropriate here.
> Yes, they are. (Just because structs exist doesn’t mean you have to use them everywhere.)
> swift-users mailing list
> swift-users at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users