[swift-evolution] [Proposal] Explicit Synthetic Behaviour

Brent Royal-Gordon brent at architechies.com
Wed Sep 6 18:11:25 CDT 2017


> On Sep 5, 2017, at 1:02 PM, Haravikk via swift-evolution <swift-evolution at swift.org> wrote:
> 
> This proposal idea is essentially for a new attribute @synthetic (name is up for debate). This attribute is required for any default implementation that includes reflective type compiler magic, use of the reflection API against `self` or, in future, any native Swift macros within the method (possibly limited to specific features, will depend on the macro language and its capabilities).


"Use of the reflection API against `self`"? `String(describing:)` and `String(reflecting:)` sometimes do that.

I see zero justification for having @synthetic cover all of these random things, but not ordinary default implementations—they have the same amount of dangerous implicitness. And I think we agree that using default methods only when @synthetic is specified is a non-starter, if only because default methods are a backwards compatibility tool for library evolution.

We should show these pseudo-default methods in the generated interface for the module and be done with it. They only seem scary right now because people haven't had time to grow comfortable with them.

-- 
Brent Royal-Gordon
Architechies

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170906/2513e9ce/attachment.html>


More information about the swift-evolution mailing list