-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Reader macro tests could be more rigourous #560
Comments
That's a good catch. Can you send a pull request with a test addition to step7 tests that covers this? Then I'll activate Github CI against the PR to make sure that all the other implementations also pass and merge it if so (and if they don't pass then we'll work on fixing those implementations first). |
Just working on this now, and have hit an 'I don't really know what I am doing' problem. In order to use the test above, I have put the test addition into step8 rather than step7, so I can use defmacro!. The test has been modified slightly - the macro is as above but collapsed to one line (test suite doesn't seem to like multi-line expressions); also the spurious space at the end of the first arg to println has been removed, and looks like this:
This passes fine in my own ruby-wgm implementation, but seems to fail for a variety of reasons wherever else I test it (ruby, c, rust, perl, go, python). This causes me to suspect that my own implementation is doing the wrong thing. If so, I can't work out why. Bit stumped. Not sure whether to go ahead and submit a pull request anyway just yet: please advise. |
Hi.
This makes sense. Could you please submit your interpreter and/or test the following commands?
All four should answer I am also curious of the answer of |
Thank you. My interpreter is here fwiw: https://github.com/wgmyers/mal/tree/ruby-wgm/impls/ruby-wgm - running the four tests you suggested do indeed all answer The underlying issue is me not yet having a full understanding of when lists are evaluated during the apply phase, attempting to use expressions like In the meantime, if I just replace |
A bug crashing |
I think the commit that fixed it was this one: wgmyers@ca801cc#diff-1cff364f582518ba9c02dd928b6df7f85e697c5639b59ccf5bedf3cf09968656 |
It seems difficult to extract a minimal test, and such a test may not be as useful as I expected because few implementations will mix list/vector/map delimitors and reader macros. |
I had a go at implementing Mal in Ruby and somehow managed to get all the way to completion of Step A - including passing all the self-hosting tests - with a huge bug in the reader macro expansion code.
This only came to light when
make "perf^foo"
failed.Turned out that the 'time' function was being truncated after the first
let*
in the quasiquote. Replacing the backtick with the quasiquote form typed out longhand showed me where the bug was.I'm struggling to figure out what the best way to test this is because this is also my first exposure to any kind of Lisp, with which I am also struggling tbh, but something like:
would have caught this bug - the above should produce:
but with incorrect quasiquote expansion, gets nothing at all, or just blows up.
The text was updated successfully, but these errors were encountered: