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

hashes are implemented oddly #95

Closed
skx opened this issue Nov 13, 2022 · 0 comments · Fixed by #96
Closed

hashes are implemented oddly #95

skx opened this issue Nov 13, 2022 · 0 comments · Fixed by #96

Comments

@skx
Copy link
Owner

skx commented Nov 13, 2022

When a hash is created we populate the keys as expected, but we set the value to "readExpression..".

i.e. Hash values are not evaluated at creation time. Instead when a hash is returned as an object, via "eval" the values are evaluated then.

At the time this made sense because readExpression doesn't have access to the environment, nor does it keep track of the state of macros.

The code as-is is fine, but it requires evaluations when arrays are passed around which is gonna slow things down.

  • Update readExpression to take an env. parameter
  • And macro flag
  • Then eval at parse-time.
skx added a commit that referenced this issue Nov 13, 2022
Rather than evaluate their keys *every* time they are used
we only do so once, at parse time, as we should have done
from the start.

This involved changing the signature of readExpression, but
as a purely internal function that's 100% acceptible.

This closes #95.
@skx skx closed this as completed in #96 Nov 13, 2022
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 a pull request may close this issue.

1 participant