[swift-evolution] [Proposal] Explicit Synthetic Behaviour

Jonathan Hull jhull at gbis.com
Mon Sep 11 06:35:14 CDT 2017


What if we tried a completely different type of solution (which might solve the issue for protocol default conformances too)?

Right now there are errors and warnings.  What if we add a third type of compiler feedback (let’s call it a note).  A note is a little bit like a warning, but it can be dismissed/acknowledged.  It is only generated once for a particular issue, and then it is remembered that you dismissed it so it won’t come back every time you compile.

So in this case, when you add an Equatable conformance post-hoc, you get a note (let’s say it looks like a warning, but is grey instead of yellow and has a different icon) saying something like “Equatable conformance was automatically synthesized”.  If you want to remember to add your own conformance, you can just leave the note there as a reminder to yourself until you do it.  If you want the automatic conformance then you just dismiss the note and it never bothers you again.

Thanks,
Jon

> On Sep 7, 2017, at 12:52 PM, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
> 
> This is a particularly interesting use case that demonstrates a weakness without a good workaround. I, for one, am glad you brought it up, and agree with comments above that auto-generated mandatory enum conformance is a topic perhaps worth revisiting, given this compelling example.
> On Thu, Sep 7, 2017 at 14:32 Gwendal Roué via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> 
>> Le 7 sept. 2017 à 19:53, Tony Allevato <tony.allevato at gmail.com <mailto:tony.allevato at gmail.com>> a écrit :
>> 
>> Again, this is not the issue that Haravikk is describing in this thread.
> 
> Yes, I better understand now. Please forgive the pollution.
> 
> Gwendal
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170911/24815e6a/attachment.html>


More information about the swift-evolution mailing list