-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[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
[DOC] Tweaks for String#<< #13306
Conversation
string.c
Outdated
* 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) |
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.
We lost information about this exception case, is that deliberate?
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. In general, the doc guide discourages mentioning exceptions. In this case, I thought the error message for the raised exception explains itself.
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.
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.
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.
Restored.
No description provided.