Quick question: Constraint Aliasing


(Erica Sadun) #1

Can anyone give me a rough estimate of how hard (in terms of coding, not in terms of Swift Evolution process) it would be to adopt (1) `extension Set<ShippingOptions>` as an outright alias for `extension Set where Element == ShippingOptions` and (2) `extension [ShippingOptions]` for `extension Array where Element == ShippingOptions`?

Thanks,

-- E


(David Hart) #2

I have the impression this would be simple enough because it would only live in the parser. But I'm no expert.

···

On 12 May 2017, at 01:50, Erica Sadun via swift-evolution <swift-evolution@swift.org> wrote:

Can anyone give me a rough estimate of how hard (in terms of coding, not in terms of Swift Evolution process) it would be to adopt (1) `extension Set<ShippingOptions>` as an outright alias for `extension Set where Element == ShippingOptions` and (2) `extension [ShippingOptions]` for `extension Array where Element == ShippingOptions`?

Thanks,

-- E

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Dave Abrahams) #3

You would need some way to tell the compiler which associated type goes
in the <>s.

···

on Thu May 11 2017, David Hart <swift-evolution@swift.org> wrote:

I have the impression this would be simple enough because it would only live in the parser. But I'm
no expert.

--
-Dave


(David Hart) #4

I have the impression this would be simple enough because it would only live in the parser. But I'm
no expert.

You would need some way to tell the compiler which associated type goes
in the <>s.

I don’t think we are talking about associated types but only of generic arguments (Set, Array). But perhaps you’re going to say it’s a bad idea to promote (through a nicer syntax) writing generic algorithms over Array when they could be written against Sequence.

···

On 12 May 2017, at 09:05, Dave Abrahams via swift-evolution <swift-evolution@swift.org> wrote:
on Thu May 11 2017, David Hart <swift-evolution@swift.org> wrote:

--
-Dave

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution


(Dave Abrahams) #5

I have the impression this would be simple enough because it would only live in the parser. But

I'm

no expert.

You would need some way to tell the compiler which associated type goes
in the <>s.

I don’t think we are talking about associated types but only of
generic arguments (Set, Array).

Sorry, I missed that.

But perhaps you’re going to say it’s a bad idea to promote (through a
nicer syntax) writing generic algorithms over Array when they could be
written against Sequence.

I wasn't going to say that. :wink:

···

on Fri May 12 2017, David Hart <david-AT-hartbit.com> wrote:

On 12 May 2017, at 09:05, Dave Abrahams via swift-evolution <swift-evolution@swift.org> wrote:
on Thu May 11 2017, David Hart <swift-evolution@swift.org> wrote:

--
-Dave