-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Spec String#unsafe_byte_at #5500
Conversation
Sorry for the harsh message below. Nothing personal, I just don't think that more time should be spent in this direction. But also feel free to ignore me. So the behavior is There is no precedent for naming things as |
As for your question: the behavior of In practice, it returns whatever is in the memory after the string (also note that there's one guaranteed 0 byte at the end of the string) |
aa06f60
to
6d6f920
Compare
I didn’t find this harsh at all, I fully understand your reasoning! I cut this PR down to speccing the (defined…) |
Not sure about this, all the other string specs heavily test this internal method so it has coverage already. |
I agree here, I don't think we need to add general unsafe methods, specially when they are not used a lot. At most they should be protected. Same goes with unsafe_byte_at, should be protected or undocumented, can be easily achieved with to_unsafe[I] |
Welllll, I tried making |
(Let me know if you think adjusting |
What purpose has |
|
|
I noticed the
String#unsafe_byte_at#unsafe_chr
pattern used in a few places, so this addsString#unsafe_chr_at
.Question: should
String#unsafe_byte_at
indeed return0_u8
on out-of-bounds index?