Open golanor opened 7 months ago
Hi, thanks for your interest. Please rebase and make the tests pass, then ping reviewers again.
Hi @cmcaine , There seems to be an issue with some versions of Julia when running this test. Do you suggest I change the test so that it would always pass, or should we try fixing the runner so there won't be a difference? It works for 1, and for the nightly (and 1.10 on my machine)
Julia 1.6 is the current LTS release, so I think we should still support it. The bug is probably because the macros are being expanded at different times on different releases, which might have been done deliberately or not.
We could fix that with eval (@test_throws TranslationError eval(:(@macroexpand rna"foo"))
), but I think we should require the user to write a function that the string macro is then expected to call. I think this is usually the better option, and is definitely the better option in this case where it is very plausible that a user would want to find the translations of strings that are not known at compile time.
How does that sound to you?
I made the changes, but then the string macro is a bit redundant, isn't it?
The macro serves the same purpose as other string macros:
What do you want the student to learn from the exercise?
I suggest changing all instances of rna"..." in the tests to rna_translator("...") and adding a couple of tests of the macro at the end.
Reason: the function interface is easier to test and understand for the student.
Alternatively, we could remove the macro version entirely.
I wanted to teach both macro writing and creating an exception. I'll settle for only learning how to create a new exception.
Feel free to put the string macro back in as a bonus question, if you like. The rot13 practice exercise has an example of this.
Renamed and added the macro as a bonus question
Can we merge this?
Sorry, I missed the updates. I'll try to take a look this week. Please ping me again if I don't.
ping @cmcaine
@cmcaine Can we merge?
I comitted the suggested changes
Cool. The example.jl will need to be changed to throw Argument error.
Here is a suggestion for the protein-translation exercise in Julia using string macros. Let me know what you think.