Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[DOC] Tweaks for String#<< #13306

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

Merged
merged 2 commits into from
May 14, 2025
Merged

Conversation

BurdetteLamar
Copy link
Member

No description provided.

@BurdetteLamar BurdetteLamar added the Documentation Improvements to documentation. label May 12, 2025
string.c Outdated
Comment on lines 4325 to 4332
* If that codepoint is not representable in the encoding of
* _string_, RangeError is raised.
*
* s = 'foo'
* s.encoding # => <Encoding:UTF-8>
* s << 0x00110000 # 1114112 out of char range (RangeError)
* s = 'foo'.encode(Encoding::EUC_JP)
* s << 0x00800080 # invalid codepoint 0x800080 in EUC-JP (RangeError)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We lost information about this exception case, is that deliberate?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. In general, the doc guide discourages mentioning exceptions. In this case, I thought the error message for the raised exception explains itself.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The doc guide states:

For corner cases of methods, such as atypical usage, briefly mention the behavior, but do not provide any examples.

Only document exceptions raised if they are not obvious.

The error message might be obvious, but I don't think it's obvious what the behavior is for this exceptional case.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored.

@peterzhu2118 peterzhu2118 merged commit 7afee53 into ruby:master May 14, 2025
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improvements to documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants