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

Allow setting globals, back off of dict-likeness #42

Merged
merged 1 commit into from
Apr 22, 2022
Merged

Conversation

jordemort
Copy link
Contributor

Allow setting and deleting globals. I decided to make the object look
less like a dict to avoid confusing people. Code like this would
not work as expected:

s["x"] = [1,2,3]
s["x"][1] = 7

This is because subcripting the object converts the starlark.Value to
its Python equivalent and then returns it. Subsequent modifications to
the object it returns aren't reflected back to Starlark, though. So
hopefully by avoiding looking too much like a dict, we'll prevent
users from getting confused.

Allow setting and deleting globals. I decided to make the object look
less like a `dict` to avoid confusing people. Code like this would
not work as expected:

s["x"] = [1,2,3]
s["x"][1] = 7

This is because subcripting the object converts the starlark.Value to
its Python equivalent and then returns it. Subsequent modifications to
the object it returns aren't reflected back to Starlark, though. So
hopefully by avoiding looking too much like a `dict`, we'll prevent
users from getting confused.
@jordemort jordemort merged commit a77eb57 into main Apr 22, 2022
@jordemort jordemort deleted the setters branch April 22, 2022 21:40
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.

1 participant