> On Sep 13, 2017, at 12:23 PM, Matthew Johnson via swift-dev > <swift-dev@swift.org> wrote: > > > > Sent from my iPhone > >> On Sep 13, 2017, at 11:56 AM, David Zarzycki via swift-dev >> <swift-dev@swift.org> wrote: >> >> >> >>> On Sep 13, 2017, at 13:53, David Sweeris <daveswee...@mac.com> wrote: >>> >>> >>>> On Sep 13, 2017, at 09:54, David Zarzycki via swift-dev >>>> <swift-dev@swift.org> wrote: >>>> >>>> Hello, >>>> >>>> As a part of a research project that I’m working on, I’ve started bumping >>>> into the need for value-type bound protocols (as opposed to the existing >>>> class bound protocols). Is this something that would be worth proposing >>>> formally? Or should I just keep the patch I have on my research branch? >>> >>> I think it'd be worth a proposal, especially if can talk about why you >>> needed it. >> >> While I look forward to talking about my research, I’m not ready to do in >> the near future. >> >> That being said, value-type bound protocols seem independently useful and >> that is why I emailed the list. >> >> I think the use case for this is generic algorithms. Why? Because it can be >> hard to impossible to write *robust* generic code when you don’t know >> whether an abstract type copies by value or by reference during >> assignment/initialization. With class-bound protocols, you can guarantee >> reference semantics, but there is no analogous feature for ensuring value >> semantics. I have a small (~150 line) patch that fixes this. > > Value types and value semantics are not the same. Most people who have asked > for this capability actually want a constraint for value semantics, not value > types. Is that what you're asking for as well?
Right. For instance, if I have a struct containing a field of reference type, is this struct a ‘value type’? Slava > >> >> Dave >> _______________________________________________ >> swift-dev mailing list >> swift-dev@swift.org <mailto:swift-dev@swift.org> >> https://lists.swift.org/mailman/listinfo/swift-dev >> <https://lists.swift.org/mailman/listinfo/swift-dev> > > _______________________________________________ > swift-dev mailing list > swift-dev@swift.org <mailto:swift-dev@swift.org> > https://lists.swift.org/mailman/listinfo/swift-dev > <https://lists.swift.org/mailman/listinfo/swift-dev>
_______________________________________________ swift-dev mailing list swift-dev@swift.org https://lists.swift.org/mailman/listinfo/swift-dev