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

Use a variable to access a hash #143

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jmks
Copy link
Contributor

@jmks jmks commented Oct 18, 2024

I took a shot at fixing #142

Added an identifier to object access (i.e. between [..]). The tricky part is that ends up as a string when reaching Context.get_in/3, so you can't know if you want to access that value or the value a variable points to.

So I tagged the value with :reference (maybe that's not a great name). Then Context.get_in/3 has to resolve what value that variable points to.

I wrote a test showing that a variable pointing to a variable pointing to a variable works but that may "just work" because of how the Assign works. So maybe that test is unnecessary.

That seems to work but I'm not sure if there's a better way to do this.

Copy link
Owner

@edgurgel edgurgel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me!

I think the only thing that we might want to add in the future is that with strict_variables options we want to warn if a variable is not defined but that can be done as a separate piece of work.

Thank you!

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.

2 participants