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

Implement the Starlark index expression assignment operation #497

Merged
merged 9 commits into from
May 7, 2024

Conversation

mahmoudimus
Copy link
Contributor

Description of changes in release / Impact of release:

In a nutshell, this PR allows one to set an object's value using object[key] = value.

Starlark's specification actually supports this, but the Java implementation does not, even though the Go and Rust implementation do.

This is an initial implementation attempt to do so. In addition, the failing tests are now passing to ensure that this behavior is additive and enhancing while maintaining backward compatibility. A nice side effect of this PR is that it also addresses #292.

Documentation

Read the StarlarkSetIndexable class and observe the implementation in LarkyIndexable

Risks of this release

Is this a breaking change?

  • Yes
  • No

Is there a way to disable the change?

  • Use previous release
  • Use a feature flag
  • No

kochniev and others added 9 commits May 6, 2024 11:51
…throwing an exception.

The error message is: Error: can only assign an element in a dictionary or a list, not in a 'MutableStruct'. Let's make the tests pass!
StarlarkIndexable.

We follow the exact same interface and modifications for
StarlarkIndexable and update the error message to signify that we now
support setIndex on dictionaries, lists, and any implementation of
StarlarkSetIndexable. We also support the equivalent
StarlarkIndexable.Threaded interface for StarlarkSetIndexable,
similary called StarlarkSetIndexable.Threaded.
…ll the exact same interface with LarkyMapping. Delete StarlarkMapping and move the functionality to LarkyMapping
…lasses to primitives in larky (as we would do in python). as a result, we have to return a raw list on the view instead of an actual view
@mahmoudimus mahmoudimus force-pushed the allow-set-indexable branch from 409c1ee to 7ddfac1 Compare May 6, 2024 23:02
@sharifelgamal sharifelgamal marked this pull request as ready for review May 7, 2024 15:46
@mahmoudimus mahmoudimus mentioned this pull request May 7, 2024
5 tasks
@sharifelgamal sharifelgamal merged commit 676db64 into master May 7, 2024
2 checks passed
mahmoudimus added a commit that referenced this pull request May 9, 2024
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

Successfully merging this pull request may close these issues.

5 participants