-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
unicode/utf8: add "Rune"-less aliases #11743
Comments
I vote no. Unnecessary documentation cognitive load & godoc noise for minor improvement. |
They are so not Go-like now and they always rub me the wrong way, but they are obviously not necessary. |
The duplication would be more gross than the long names, IMO. |
I've used the package a few times and been bothred by the unidiomatic names, but I'd be more bothered with having to jump back and forth trying to figure out what the difference was between Decode and DecodeRune only to discover there was none. It wouldn't be clear in the package's Index, at least. Changing the documentation of DecodeRune to "deprecated: use Decode" only exchanges awkwardness for clutter. Could this be marked Go2? That would be the best time to clean it up all at once and simple renamings are eminently go fix-able. |
With #17056 I don't have any objection since the deprecated versions would be hidden by default. |
Well, at this point we could actually add Rune-less aliases (just kidding). |
@robpike: actually, there is something to say for using aliases here:
|
@mpvl: At the moment, aliases are only across package boundaries, so using them in this case would require new, possibly internal packages. That is not worthwhile. But they are there for refactoring, and if the restrictions are softened then of course that would work. That was my point. |
@r: Ah right, too bad. Yeah, the internal package approach is out of the question. |
The names in the utf8 package are clumsy. We could add nicer aliases, such as Decode for DecodeRune.
Decode(p []byte) (r rune, size int)
DecodeString(s string) (r rune, size int)
DecodeLast(p []byte) (r rune, size int)
DecodeLastString(s string) (r rune, size int)
similarly for Encode.
The text was updated successfully, but these errors were encountered: