[swift-evolution] [Review] SE-0081: Move where clause to end of declaration
Karl
razielim at gmail.com
Sat May 14 03:50:54 CDT 2016
Oops, StringCollection and IntegerSequence are bad examples, because we’d need to improve existentials before it could apply to those specific examples.
But that’s desperately needed anyway. I’d still recommend ‘Generalised Existentials’ (generics manifesto) + generic typealiases over moving the where clause.
> On 14 May 2016, at 10:37, Karl Wagner <razielim at gmail.com> wrote:
>
>> * What is your evaluation of the proposal?
>
> -1
>
>> * How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
>
> More than a quick reading, but not really “in-depth” study…
>
>> * Does this proposal fit well with the feel and direction of Swift?
>
> I don’t really think it does. I don’t remember anything in Swift that went through such a bizarre change just because it looks ugly.
>
> I mean, the where clause isn’t a comment; it’s not documentation. It’s absolutely vital to anybody and everybody who uses anything with one. Really, I can’t see any logic to splitting the parameter name and constraints. It’s completely baffling, and if it wasn’t that they’re “ugly” I don’t think anybody would give this proposal a second thought. Besides, when I need to look up which parameters I need for a type, it’s nice to have them all in one place in a clearly delimited section of the declaration.
>
>> * Is the problem being addressed significant enough to warrant a change to Swift?
>> * If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
>
> I’m with Jon Shier on this - it is a problem, but it’s one inherent to generics. In some languages, you have great big whoppers for type parameters and have to pass them around everywhere you go; we’re relatively clean with Swift. Nobody writing swift should complain about our type parameters being too messy:
>
> interface Feeder<F extends Food, A extends Animal<F,?>, S extends Store<F>> {
> public void buyFoodAndFeed(A animal, S store);
> }
> class StoreFeeder implements Feeder<Grass, Animal<Grass, ?>, Store<Grass>> {
> public void buyFoodAndFeed(Animal<Grass, ?> animal, Store<Grass> store) {
> animal.eat(store.buyFood());
> }
> }
>
> I have a counter-proposal to tackle the readability issue: that we extend SE-0048: Generic Typealiases [1] to include where clauses. The proposal already mentions this, and simply says "If there is a compelling reason to add this, we can consider extending the model to support them in the future, based on the merits of those reasons.” If we did that, we could drastically shorten function/class declarations - using, say, “StringCollection” or “IntegerSequence” rather than <C:Collection where C.Iterator.Element==String>.
>
> [1](https://github.com/apple/swift-evolution/blob/master/proposals/0048-generic-typealias.md)
>
>
>> On 10 May 2016, at 20:51, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
>>
>> Hello Swift community,
>>
>> The review of "SE-0081: Move where clause to end of declaration" begins now and runs through May 16. The proposal is available here:
>>
>> https://github.com/apple/swift-evolution/blob/master/proposals/0081-move-where-expression.md
>>
>> Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at
>>
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>>
>> or, if you would like to keep your feedback private, directly to the review manager.
>>
>> What goes into a review?
>>
>> The goal of the review process is to improve the proposal under review through constructive criticism and contribute to the direction of Swift. When writing your review, here are some questions you might want to answer in your review:
>>
>>
>> More information about the Swift evolution process is available at
>>
>> https://github.com/apple/swift-evolution/blob/master/process.md
>>
>> Thank you,
>>
>> -Chris Lattner
>> Review Manager
>>
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
More information about the swift-evolution
mailing list