[swift-evolution] [Pitch] Remove type inference for associated types

Austin Zheng austinzheng at gmail.com
Mon Jun 27 15:12:10 CDT 2016


Thanks for your response, Dave.

There is a bit of a dilemma here: wait until the generics and type system
features have stabilized at the risk of making major source-breaking
changes after 3.0, or make changes now without clarity about the future of
the generics system.

Given that this topic showed up both in Chris's list of open design topics
and in the generics manifesto, I assume that someone on the core team
wanted a discussion about it before Swift 3 closes. I would be interested
in knowing if that's true.

Best,
Austin



On Mon, Jun 27, 2016 at 12:56 PM, Dave Abrahams via swift-evolution <
swift-evolution at swift.org> wrote:

>
> on Sat Jun 25 2016, Austin Zheng <swift-evolution at swift.org> wrote:
>
> >> On Jun 25, 2016, at 6:23 AM, Matthew Johnson <matthew at anandabits.com>
> wrote:
> >>
> >> Hi Austin,
> >>
> >> I’m sorry to say, but this proposal makes me really sad.  I consider
> >> associated type inference one of the more elegant aspects of Swift.
> >> It would be very unfortunate to lose it.
> >
> > There are lots of "elegant" things that Swift could do, but has chosen
> > not to do for pragmatic reasons (e.g. generalized implicit
> > conversions, type inference that crosses statement boundaries). Given
> > how terrible the development experience can be right now in the worst
> > case, I would happily trade off some measure of convenience for better
> > tooling.
>
> Well, the type checker's inference engine has *always* been kinda
> unreliable, and the experience is made much worse by the lack of
> recursive protocol requirements and the inability to express other
> constraints that would better guide inference, and by the “underscored
> protocols” such as _Indexable that are required to work around those
> limitations.  IMO it's premature to remove this feature before the
> inference engine is made sane, the generics features are added, and the
> library is correspondingly cleaned up, because we don't really know what
> the user experience would be.
>
> Finally, I am very concerned that there are protocols such as Collection,
> with many inferrable associated types, and that conforming to these
> protocols could become *much* uglier.
>
> --
> Dave
>
> _______________________________________________
> 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/20160627/c6ebbe82/attachment.html>


More information about the swift-evolution mailing list