> On Jan 13, 2017, at 9:33 PM, Brent Royal-Gordon <[email protected]> 
> wrote:
>> On Jan 13, 2017, at 9:50 AM, John McCall via swift-evolution 
>> <[email protected]> wrote:
>> 
>> I'm also not sure we'd ever want the element type to be inferred from 
>> context like this.  Generic subscripts as I see it are about being generic 
>> over *indexes*, not somehow about presenting a polymorphic value.
> 
> I think I have a pretty good use case for generic element types: you may want 
> an index to carry the type of its element. For example, suppose you want to 
> have a sort of dictionary whose keys are unique instances of a key class, and 
> whose value type depends on the key instance:

Oh, sorry, I didn't mean to suggest that the value type shouldn't be allowed to 
depend on the subscript's type parameters at all, just that it should probably 
be determinable from the index type.  I'm not sure that I have a specific 
technical concern, though, as long as it's a given that any particular access 
assigns a single type to the value; but I'll need to think about it.

John.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to