Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconsider NominalElementDictionary #122

Open
dabrahams opened this issue Oct 20, 2020 · 1 comment
Open

Reconsider NominalElementDictionary #122

dabrahams opened this issue Oct 20, 2020 · 1 comment

Comments

@dabrahams
Copy link
Collaborator

dabrahams commented Oct 20, 2020

As I have been working on InsertionOrderedDictionary, I've started to wonder whether NominalElementDictionary was such a hot idea. Instead, maybe the thing to do is make an extension on Dictionary called nominalElements that presents the (key: Key, value: Value) elements as a Collection of KeyValuePair<Key, Value>. When people need the capabilities associated with a collection of KeyValuePair, they can use this extension. Otherwise it just sits there.

Part of the reason for this is that you lose convenient destructuring that was available with tuples. Part is the massive complexity overhead of making the whole dictionary API just in order to be able to use Collection where Element: SomeProtocol extensions.

/cc @saeta @marcrasi

@dabrahams
Copy link
Collaborator Author

Or even project Tuple2's, and drop KeyValuePair.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant