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

Dictionaries don't behave like lists #3328

Open
brianharvey opened this issue Mar 9, 2024 · 3 comments
Open

Dictionaries don't behave like lists #3328

brianharvey opened this issue Mar 9, 2024 · 3 comments

Comments

@brianharvey
Copy link
Collaborator

So, when y'all added dictionaries, you took pains (perhaps to make me happy?) to make them look like regular lists, merely extending the domain of ITEM. But when you try to mutate a dictionary, the results don't match what you'd expect from how lists behave. The worst case is
deaeefb3c5711d0974604ef39eb84220fbdfe9ef
which replaces instead of inserting. I thought maybe that's because the item to be inserted didn't include a key, but this doesn't work either:
help-test script pic

That's the worst case because it loses information, but there are other examples in which it's just the order of items in the list that's lost:
3f0f8ef22102914a66ce212f9767f6a016726c2d

See more at https://forum.snap.berkeley.edu/t/replace-block-with-paired-values/16255

You'll say that this behavior doesn't matter for the use cases for dictionaries you have in mind, but I think if they look like lists, they should behave like lists.

@jmoenig
Copy link
Owner

jmoenig commented Mar 9, 2024

Sigh. We talked about this in extenso when we first designed dicts a long time ago, and you were cool about it then.

@brianharvey
Copy link
Collaborator Author

I think I must not have understood that INSERT would actually do REPLACE.

@jmoenig
Copy link
Owner

jmoenig commented Mar 9, 2024

Both do the same - only - in the case of non-numerical indices

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

No branches or pull requests

2 participants