Skip to content

Remove the as_ref check in RNA? #76

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

Closed
IanWhitney opened this issue Feb 29, 2016 · 4 comments
Closed

Remove the as_ref check in RNA? #76

IanWhitney opened this issue Feb 29, 2016 · 4 comments

Comments

@IanWhitney
Copy link
Contributor

This might be because I'm new to Rust, but I don't see the value of this test in the RNA transcription exercise. It doesn't seem germane to the problem, and the commit that introduced it doesn't really explain why it's there.

Its presence seems to require the solver to implement AsRef for their Struct (as shown in the example solution) just so that the test can be passed. Implementing AsRef doesn't add any other value, as far as I can see. All the other tests are passable without implementing AsRef.

But, again, new to Rust here so I'm probably missing something. My solution, which passes all tests but the as_ref one is here: https://gist.github.com/IanWhitney/b2ac83ae8195f5fc1a75

@kytrinyx
Copy link
Member

I'm not sure (not familiar with Rust). @bitborn do you remember what this was about?
@petertseng @EduardoBautista do you have any ideas here?

@petertseng
Copy link
Member

In its initial form, it appears this test just wanted conversion to a string. Asking for that may be clearer than as_ref. I would have suggested https://doc.rust-lang.org/std/string/trait.ToString.html, but apparently you shouldn't implement this directly but instead should implement https://doc.rust-lang.org/std/fmt/trait.Display.html which requires students to think about Formatters. Might be a bit much.

Of course there's the question of "what's the value in asking students to be able to convert their RNA to a string anyway?". That I'd want to take some time to survey this problem in other languages to understand why. I've not thought about this exercise before.

@IanWhitney
Copy link
Contributor Author

FWIW, I'm familiar with the Elixir and Ruby version of this exercise and they don't have any tests like this.

@petertseng
Copy link
Member

I'm not by any means an expert on best practices in Rust (which is only relevant if there's some Rust practices reason for keeping this test in), but my current thinking is to agree - the test on converting to a string is not really useful (it's not to do with the problem statement, there's no clear use case for converting the RNA to a string, other languages don't do it, and other tests in xrust don't do it). I'm in favor of removing it.

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

3 participants