(WIP) forth: implement#753
Conversation
4868fb9 to
76b1047
Compare
N-Parsons
left a comment
There was a problem hiding this comment.
It would be best to avoid using input as an argument in your example.py since input is a built-in function and this can cause confusion.
It would also be preferable for your example.py to use named exception types in your try: ... except: ... blocks rather than just catching all possible exceptions.
I think that the tests would be better implemented using exceptions rather than returning None. In gforth, most of these errors would raise a "stack underflow", so we could define a custom StackUnderflow exception. Division by zero could raise a ZeroDivisionError and other errors would probably be fine with ValueError.
| "core": false, | ||
| "unlocked_by": null, | ||
| "difficulty": 10, | ||
| "topics": [ |
There was a problem hiding this comment.
We've switched to snake_case naming convention for topics to increase consistency among tracks, so could you please choose them from the following list - https://github.com/exercism/problem-specifications/blob/master/TOPICS.txt
There was a problem hiding this comment.
Topics renamed to conform to naming convention.
ilya-khadykin
left a comment
There was a problem hiding this comment.
Overall it looks good 👍
I've left some comments
@N-Parsons pointed to some issues, I think they should be addressed as well
| from forth import evaluate | ||
|
|
||
|
|
||
| class ForthAdditionTest(unittest.TestCase): |
There was a problem hiding this comment.
Are these test cases adopted from https://github.com/exercism/problem-specifications/blob/master/exercises/forth/canonical-data.json?
If so, please state that in the comment denoting version as well
There was a problem hiding this comment.
Yes, they were adapted from the canonical data. Comment with test data version has been added.
There was a problem hiding this comment.
Don't forget that from example import ... needs to be changed back to from forth import ....
| "uuid": "e348a307-078c-5280-65af-a159283d4e79438b755", | ||
| "slug": "forth", | ||
| "core": false, | ||
| "unlocked_by": null, |
There was a problem hiding this comment.
Not sure why difficulty is set to maximum value, it should be lower
There was a problem hiding this comment.
Difficulty lowered to 5.
exercises/forth/example.py
Outdated
| @@ -1,8 +1,12 @@ | |||
| class UnderflowError(Exception): | |||
There was a problem hiding this comment.
Minor point, but I think this might be better as a StackUnderflowError to make its meaning a bit more clear and to differentiate it from arithmetic underflow.
There was a problem hiding this comment.
When you put it that way, I agree. Original intent was to match convention, since there is an existing OverflowError.
|
Thanks for your work and congrats on implementing this one 👍, @cmccandless |
|
@cmccandless, one more thing: will you please remove |
Resolves #739
TODO:
forthtoconfig.jsonforth.pyforth_test.pyexample.py