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

Austin Zheng austinzheng at gmail.com
Sun Jun 26 23:42:41 CDT 2016


Oops, that looks like a typo. All those types should be conforming to Sequence, not StringBag (or nothing at all). I'll fix it.

Best,
Austin

> On Jun 26, 2016, at 9:39 PM, Charlie Monroe <charlie at charliemonroe.net> wrote:
> 
> I'm not quite what would be the behavior of this in the proposal:
> 
> extension IntBag : StringBag {
>     associatedtype Element = Element
> }
> 
> since both IntBag and StringBag are classes - would IntBag use StringBag's code, but replace String with Int? Or would it just contain both 
> 
> func object(at index: Int) -> Int?
> 
> and
> 
> func object(at index: Int) -> String?
> 
> if that is the case, what if the protocol contains a non-generic function like
> 
> func countElements() -> Int
> 
> ?
> 
> 
>> On Jun 25, 2016, at 8:35 PM, Austin Zheng via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> Hi all,
>> 
>> Thank you for all your comments and feedback! I've rewritten and expanded the proposal to address as many peoples' concerns as possible.
>> 
>> Best,
>> Austin
>> 
>>> On Jun 24, 2016, at 10:50 PM, Austin Zheng <austinzheng at gmail.com <mailto:austinzheng at gmail.com>> wrote:
>>> 
>>> Hello all,
>>> 
>>> Per Chris Lattner's list of open Swift 3 design topics (http://article.gmane.org/gmane.comp.lang.swift.evolution/21369 <http://article.gmane.org/gmane.comp.lang.swift.evolution/21369>), I've put together a proposal for removing type inference for associated types.
>>> 
>>> It can be found here: https://github.com/austinzheng/swift-evolution/blob/az-assoctypeinf/proposals/XXXX-remove-assoctype-inference.md <https://github.com/austinzheng/swift-evolution/blob/az-assoctypeinf/proposals/XXXX-remove-assoctype-inference.md>
>>> 
>>> Thoughts, criticism, and feedback welcome. There are at least two slightly different designs in the proposal, and I'm sure people will have ideas for even more.
>>> 
>>> Best,
>>> Austin
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto: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/20160626/4cc84a9d/attachment.html>


More information about the swift-evolution mailing list