-
-
Notifications
You must be signed in to change notification settings - Fork 554
Reverse String: Add emoji bonus to description #1503
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
Conversation
I've added an emoji bonus to the description of reverse string. This introduces Unicode. Knowing that there are different ways to encode text, and that not all characters are the same size is important. I've made it a bonus because it's not straight forward in every language.
Maybe this would be better as a whole new exercise- Unicode Reverse String. This way languages that don't make Unicode convenient can easily skip it. Let me know your thoughts |
The Rust track already has two track-specific tests like this one: The first of these tests wide characters, and is part of the basic test suite. This is because in rust it is easy to reverse a string of characters regardless of width. The second is feature-locked, because it involves reversing on a grapheme basis, which is more complicated. By default this test is excluded from the tests run; it only runs if you run the test suite with a particular flag. It's meant to give students who are interested some more insight into how unicode works. |
I purposely didn't mention multiple characters making up a single grapheme and picked emojis where this wasn't a concern. Rust has a good 3rd party library for this, but I don't think that's true for a lot of languages. I think there are 3 types of languages to consider:
I think the bonus text is helpful for students of # 1 and # 2. But I worry that students of # 3 might get frustrated trying to make it work. For this reason, I'm beginning to think within the problem specifications it may be better to make Unicode reverse string into a separate exercise. |
I agree with your categorization of languages. I think that the right level of unicode depends on which type a language is. For type 1 languages, I think that wide chars such as the emoji you used or the kanji Rust uses should be part of the basic test suite, and bonuses should introduce something new, such as multi-character graphemes. The language does a lot to make things easy, so let's show the students how easy it really is. For type 2 languages, I agree with you: a bonus test with wide characters should be part of the normal suite, but reversing multi-character graphemes might be too much unless there exists a good external library, so it should be optional and track-specific. For type 3 languages, a wide character test might be part of the bonus tests, but doesn't need to be part of the standard test suite. In all these cases, the bonus exercise introduces a level of difficulty above and beyond the standard test suite. However, because the difficult bonus for type 3 languages is appropriately part of the standard test suite for type 1 languages, it is very difficult to add reasonable test cases in a track-independent way. Possibly the best way to handle this is a detailed comment in the canonical data talking about the categorization of languages and giving some sample inputs and outputs both for wide characters and multi-char graphemes. That way each track could implement idiomatic tests according to its categorization. |
Move the unicode bonus to the exercises instead of the description. This will allow the exercises to automatically be brought into the various tracks. I was originally going to use 👍🏽 as the grapheme example. But as it is split in my terminal (Gnome Terminal) and my editor (Visual Studio Code), I presume it would be split for most students. Displaying it split might make it confusing.
@coriolinus, have I done what you had in mind in my latest commit? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that was exactly what I had in mind. This looks great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for creating this PR, but I would like to hold off with merging this PR until we have resolved: #1492. That issues discusses how we should deal with cross-language concerns.
Hi @ccouzens! I welcome your PR, but some years ago we agreed upon a "no unicode" rule, since unicode handling in some languages is below par. But we also agreed upon that extra exercises might get created that do unicode. Even as an optional exercise, unicode might be problematic, as unicode might confuse generators of languages that do not deal very well with unicode, which we also want to avoid. |
Oh and as @NobbZ said, we do welcome PR's! |
Unicode exercises are on the list of soon to be added! |
I like the idea of separate exercises for handling unicode. That way, tracks that don't have good unicode support can mark the exercise as |
Agreed! What do you think @ccouzens? Are you okay with waiting for/helping with a separate Unicode exercise? |
Thanks everyone 🙂
I like that idea. I hope to have time tomorrow to move these changes into a new unicode-reverse-string exercise. There would be other advantages beyond the technical ones, such as being able to use the Readme to give a brief overview of unicode. |
Could you perhaps open an issue first? We are trying to give all (new) exercises a background story, so a little discussion on the specific story first could help. For reference, see #1470. |
I've opened #1507. I don't think there was much scope for a story with reversing strings, so I've made the challenge about truncating them to 5 characters. |
I'm going to close this pull request, because it looks like I'll be creating a different exercise instead #1507 |
I've added an emoji bonus to the description of reverse string.
This introduces Unicode. Knowing that there are different ways to encode
text, and that not all characters are the same size is important.
I've made it a bonus because it's not straight forward in every
language.