-
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
Mal implementation by Crystal #70
Conversation
Crystal seems to treat 'Proc(Args..., Ret)' as '(Args...) -> Ret' but distinguishes 'Proc(Args..., Ret)' from '(Args...) -> Ret'. It causes a type-mismatch error. I added some workarounds for it.
all tests passed in step3
the test (def! res1 (sum-to 10000)) failed in my environment because it could compute the result even if TCO is not available. If stack overflow happens, the interpreter will go into SEGV.
@rhysd something seems to be off with printing:
I tested with crystal-0.7.2 on Ubuntu 14.04.1 |
Sorry, previous deleted comments were my mistake. It seemed that I didn't notice the bug because of compiler's cache. I'll fix it. |
It seems that |
I fixed the bug then confirmed tests for step0 ~ stepA and self-hosted mal with Crystal 0.7.2. |
Thank you! |
@rhysd You're welcome! Do you have any feedback on the guide? Especially places where you got stuck that the guide could have helped address? I did a couple of minor cleanups to the Makefile. I also pushed an update to the README to bump the language count (35 now!) and to list you as the creator of this implementation. The only thing left is for you to tweet about it and I'll retweet :-) |
Sorry, I failed to catch your reply.
I see. Thank you for your work.
I think it is better to add more tests for object deepcopy. Many languages (including Crystal) provide reference semantics, which employs shallow copy to copy array, dictionary and so on. It leads to shallow copy of mal's object and enables to change a value in environment from outside. |
@rhysd that's a good point. Do you have some example tests that would have caught the problem in your case? |
Mal implementation by Crystal
Mal implementation by Crystal
I implemented all steps of Mal by Crystal.
I checked that my implementation passed all test cases and self-hosted Mal implementation also passed in my OS X environment.