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

Macros don't work in second-order self-hosting #431

Closed
bjh21 opened this issue Jul 27, 2019 · 2 comments
Closed

Macros don't work in second-order self-hosting #431

bjh21 opened this issue Jul 27, 2019 · 2 comments

Comments

@bjh21
Copy link
Contributor

bjh21 commented Jul 27, 2019

If I run the mal implementation of mal inside itself, macros stop working (test is from tests/step8_macros.mal):

bjh21@sole:~/mal/python$ python stepA_mal.py ../mal/stepA_mal.mal ../mal/stepA_mal.mal
Mal [python-mal-mal]
nil
mal-user> (defmacro! one (fn* () 1))
{:__MAL_MACRO__ (EVAL (nth ast 2) env)}
mal-user> (one)
Uncaught exception: 'Hash_Map' object is not callable

The problem seems to have been introduced by #400. af49dc5 works:

bjh21@sole:~/mal/python$ python stepA_mal.py ../mal/stepA_mal.mal ../mal/stepA_mal.mal
Mal [python-mal-mal]
mal-user> (defmacro! one (fn* () 1))
<function fn at 0xf7919064>
mal-user> (one)
1

but ed9f32c does not:

bjh21@sole:~/mal/python$ python stepA_mal.py ../mal/stepA_mal.mal ../mal/stepA_mal.mal
Mal [python-mal-mal]
nil
mal-user> (defmacro! one (fn* () 1))
{:__MAL_MACRO__ (EVAL (nth ast 2) env)}
mal-user> (one)
Uncaught exception: 'Hash_Map' object is not callable
@kanaka
Copy link
Owner

kanaka commented Jul 29, 2019

It turns out the key issue is the new _map? function. It causes issues in a few places but the biggest issue is that it breaks the _macro? function for the second order mal instance. The _macro? function contains a (map? x) call that returns false resulting in the _macro? call returning false. I'll push something later that fixes this and also that activates second order self-hosted tests so we can catch this sort of issue in the future.

@kanaka
Copy link
Owner

kanaka commented Jul 29, 2019

ff4e5f1 has a fix and also activates a couple of second-order self-host test entries.

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

2 participants