[swift-evolution] [Proposal] Explicit Synthetic Behaviour

Gwendal Roué gwendal.roue at gmail.com
Mon Sep 11 16:42:32 CDT 2017


> Le 11 sept. 2017 à 23:41, Gwendal Roué <gwendal.roue at gmail.com> a écrit :
> 
> Doesn't it escalate pretty quickly into complex and ad-hoc language constructs?
> 
> Like everybody I like code synthesis. Like some, I'm worried that implicit synthesis would hide a few bugs that are hard to debunk. I also agree that developers who complain about those bugs would rightfully get the "behaves as expected" and "RTFM" classical answers. The problem with those deserved answers is that there's not much lesson to learn. Being bitten one, two, three times does not reduce the probability of being bitten another time. Programmer errors due to carelessness are the most difficult errors to prevent, don't you all agree?
> 
> People who use Sourcery are quite happy with AutoEquatable and AutoHashable. I don't know of anybody who complains of those. People are happy. Nobody types `AutoEquatable` by mistake: they get synthesis where they ask for it, and move on their next task without thinking much more about it. Sounds like a developer's dream, isn't it?
> 
>> This doesn't align with how Swift views the role of protocols, though. One of the criteria that the core team has said they look for in a protocol is "what generic algorithms would be written using this protocol?" AutoSynthesize doesn't satisfy that—there are no generic algorithms that you would write with AutoEquatable that differ from what you would write with Equatable.
> 
> And so everybody has to swallow implicit and non-avoidable code synthesis and shut up?

Sorry Tony, I didn't quote your sentence properly.

Gwendal

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


More information about the swift-evolution mailing list