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

Not sure how to implement test #579

Closed
Garklein opened this issue Jul 21, 2021 · 1 comment
Closed

Not sure how to implement test #579

Garklein opened this issue Jul 21, 2021 · 1 comment

Comments

@Garklein
Copy link
Contributor

When I got to the self hosting step, I had a bug that took me a week to track down. It was that whenever a hashmap was in a function and the function was called, it would replace the parameters in the mal function ast hashmap with the data of the arguments that the function was being called with. It happened because of JS's stupid object copying system.
How I found it was by making a function in mal that prints the ast of a mal function.

user>(def! test (fn* (x) {:test x}))
#<function>
user>(prnfn test)
{:test x}
nil
user> (test 3)
{:test 3}
user>(prnfn test)
{:test 3}
nil

I want to add this as a test at the function step to help people in the future, but I'm not sure how, because in different languages the asts are stored differently in mal functions.

@Garklein
Copy link
Contributor Author

Never mind, I'll just find a situation where it crashes it and use that.

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

No branches or pull requests

1 participant