[swift-evolution] [Pitch] Remove type inference for associated types
Dave Abrahams
dabrahams at apple.com
Mon Jun 27 14:56:56 CDT 2016
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
More information about the swift-evolution
mailing list