Ah, the spec does actually say: > > Converting a signed or unsigned integer value to a string type yields a > string containing the UTF-8 representation of the integer. Values outside > the range of valid Unicode code points are converted to "\uFFFD".
Personally, I think this is fine as is. I think people understand what happens from these two sentences. On Sun, Jun 11, 2023 at 7:02 PM Axel Wagner <[email protected]> wrote: > I'm not entirely sure. I don't think your phrasing is correct, as it > doesn't represent what happens if the integer value exceeds the range of > valid codepoints (i.e. if it needs more than 32 bits to represent). That > being said, the sentence as is also isn't really precise about it. From > what I can tell, the result is not valid UTF-8 in any case. > > I think it might make sense to file an issue about this, though in general > that conversion is deprecated anyway and gets flagged by `go vet` (and `go > test`) because it is not what's usually expected. So I'm not sure how > important it is to get this exactly right and understandable. > > > On Sun, Jun 11, 2023 at 5:17 PM Kamil Ziemian <[email protected]> > wrote: > >> I have some hair splitting question. In the "Conversions to and from a >> string type" we read: >> "Converting a signed or unsigned integer value to a string type yields a >> string containing the UTF-8 representation of the integer." >> >> Would it be more corrected to say, that conversion from integer to string >> gives you UTF-8 representation of code point described by value of the >> integer? Or maybe it is indeed representation of integer described by UTF-8 >> specification? >> >> Best regards, >> Kamil >> czwartek, 28 października 2021 o 19:33:27 UTC+2 Kamil Ziemian napisał(a): >> >>> Hello, >>> >>> From what I understand proper Gopher read at least one time "The Go >>> Programming Language Specification" (https://golang.org/ref/spec) and >>> now I need to read it too. >>> >>> I learn something of Extended Backus-Naur Form to understand it, so if I >>> say something stupid beyond belief, I hope you will forgive me. In the >>> first part "Notation" (https://golang.org/ref/spec#Notation) I believe >>> that I understand meaning of all concepts except of "production_name". On >>> one hand "production_name" means that it is name of the production, not >>> rocket science here. On the other, after reading about EBNF I feel that I >>> should have more information about it. Can you explain it to me? >>> >>> Again I'm new to EBNF, so maybe this is stupid question. >>> >>> Best >>> Kamil >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/06347585-fd2c-4bfa-9527-3439389c6414n%40googlegroups.com >> <https://groups.google.com/d/msgid/golang-nuts/06347585-fd2c-4bfa-9527-3439389c6414n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEkBMfHaG8bYNLvLERu0-ad57wpoWsiB%2BFC5asyKA7FH6%2BvgZw%40mail.gmail.com.
