[Review] SE-0154: Provide Custom Collections for Dictionary Keys and Values


(Douglas Gregor) #1

Hello Swift community,

The review of SE-0154 "Provide Custom Collections for Dictionary Keys and Values" begins now and runs through February 22, 2017. The proposal is available here:

https://github.com/apple/swift-evolution/blob/master/proposals/0154-dictionary-key-and-value-collections.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. When replying, please try to keep the proposal link at the top of the message:

Proposal link:

https://github.com/apple/swift-evolution/blob/master/proposals/0154-dictionary-key-and-value-collections.md
Reply text

Other replies
<https://github.com/apple/swift-evolution/pulls#what-goes-into-a-review-1>What goes into a review?

The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:

What is your evaluation of the proposal?
Is the problem being addressed significant enough to warrant a change to Swift?
Does this proposal fit well with the feel and direction of Swift?
If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
More information about the Swift evolution process is available at

https://github.com/apple/swift-evolution/blob/master/process.md
Thank you,

-Doug Gregor

Review Manager


(Adrian Zubarev) #2

What is your evaluation of the proposal?

This is welcome improvement.

Is the problem being addressed significant enough to warrant a change to Swift?

Definitely.

Does this proposal fit well with the feel and direction of Swift?

It does indeed.

If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

I can’t think of an example to compare with.

How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

Carefully read the whole proposal and took part in discussions involving the proposed solution.


(Matthew Johnson) #3

What is your evaluation of the proposal?

+1.

Is the problem being addressed significant enough to warrant a change to Swift?

Yes

Does this proposal fit well with the feel and direction of Swift?

Yes

If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

N/A

How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

A quick read.


(Martin Waitz) #4

The review of SE-0154 "Provide Custom Collections for Dictionary Keys and Values" begins now and runs through February 22, 2017. The proposal is available here:

https://github.com/apple/swift-evolution/blob/master/proposals/0154-dictionary-key-and-value-collections.md

I haven’t followed the discussion too closely, so I’m sorry if this has already been answered:
What’s the rationale for selecting this proposal over the alternatives?
Especially with the upcoming Ownership Manifesto, value mutation may be solved much more easily.
Should we invest some more time into exploring the `modify` declaration for dictionaries?

— Martin


(Scott James Remnant) #5

This proposal directly addresses one of my least favorite patterns in Swift.

It's a good improvement and I would be content with it being accepted as-is.

However I do still feel that the solution is "clunky," and that being able to mutate a dictionary entry via the Optional would be much cleaner code.

···

Sent from my iPad

On Feb 17, 2017, at 7:12 PM, Douglas Gregor <dgregor@apple.com> wrote:

Hello Swift community,

The review of SE-0154 "Provide Custom Collections for Dictionary Keys and Values" begins now and runs through February 22, 2017. The proposal is available here:

https://github.com/apple/swift-evolution/blob/master/proposals/0154-dictionary-key-and-value-collections.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. When replying, please try to keep the proposal link at the top of the message:

Proposal link:

https://github.com/apple/swift-evolution/blob/master/proposals/0154-dictionary-key-and-value-collections.md
Reply text

Other replies
What goes into a review?

The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:

What is your evaluation of the proposal?
Is the problem being addressed significant enough to warrant a change to Swift?
Does this proposal fit well with the feel and direction of Swift?
If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
More information about the Swift evolution process is available at

https://github.com/apple/swift-evolution/blob/master/process.md
Thank you,

-Doug Gregor

Review Manager

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


(Howard Lovatt) #6

The review of SE-0154 "Provide Custom Collections for Dictionary Keys and
Values" begins now and runs through February 22, 2017. The proposal is
available here:

https://github.com/apple/swift-evolution/blob/master/proposals/0154-dictionary-key-and-value-collections.md

   - What is your evaluation of the proposal?

Good idea. A good compromise between backward compatibility and usability.

   - Is the problem being addressed significant enough to warrant a
   change to Swift?

Yes

   - Does this proposal fit well with the feel and direction of Swift?

Yes

   - If you have used other languages or libraries with a similar
   feature, how do you feel that this proposal compares to those?

Yes, I have found other dictionary implementations more performance and

more flexible (e.g. Java's Map)

···

   - How much effort did you put into your review? A glance, a quick
   reading, or an in-depth study?

Quick glance

--
-- Howard.


(Dimitri Racordon) #7

What is your evaluation of the proposal?

+1

Nevertheless it’s a bit unclear to me what is the impact of these additional collections on the ownership of the dictionary.

Is the problem being addressed significant enough to warrant a change to Swift?

Yes.

If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

Python 3 addressed this issue (w.r.t Python 2) in a similar way, using dict_[keys|values] objects. It is common in that language to manipulate the dict_keys. As they are set-like structures, it allows to efficiently manipulate the keys of a dictionary prior to its access/modification.
The proposal doesn’t elaborate on the use of

I feel like the proposal’s Dictionary.Keys could benefit from a similar approach, not limiting itself to conforming to Collection.

How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

A careful reading.