[swift-users] Are value semantics really appropriate in a diagramming app?
Jack Lawrence
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.
Jack
> 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.)
>
> —Jens
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160801/55119126/attachment.html>
More information about the swift-users
mailing list