Re: [go-nuts] When would you use single quotes?

2019-02-07 Thread Volker Dobler
> > The UTF8 encoding of that codepoint is three bytes. So the rune will > still occupy 4 bytes, even if the last byte holds no data? > A rune has nothing to do with UTF-8. A rune stores the codepoint which is totally independent of any encoding (like UTF-8, UTF-16, UTF-23, EBCDIC, whatnot).

Re: [go-nuts] When would you use single quotes?

2019-02-07 Thread Jamie Caldwell
Thank you both for your answers. It is much appreciated. The UTF8 encoding of that codepoint is three bytes. So the rune will still occupy 4 bytes, even if the last byte holds no data? I'm sorry for the school boy question! Thank you. On Thu, 7 Feb 2019, 10:52 Tamás Gulácsi A rune is an

Re: [go-nuts] When would you use single quotes?

2019-02-07 Thread Tamás Gulácsi
A rune is an int32, so it takes 4 bytes by definition. A string in a struct with position, length and backing array of bytes. The backing array here consumes 3 bytes, but tge position and length occupies space too, so the string of that rune occupies more than 3 bytes after all. -- You

Re: [go-nuts] When would you use single quotes?

2019-02-07 Thread Jan Mercl
On Thu, Feb 7, 2019 at 11:25 AM Jamie Caldwell wrote: > But why would you use one over the other? Why does Go support being able to assign a codepoint using single quotes? `type rune` vs type `string` not the same, but is bit like `type byte` vs `type []byte`. The serve very different purposes.

Re: [go-nuts] When would you use single quotes?

2019-02-07 Thread Jamie Caldwell
Thank you for getting back to me, but I don't think you have answered my question. I understand they are a rune and string respectively. But *why* would you use one over the other? Why does Go support being able to assign a codepoint using single quotes? Also, why do they take more than three

Re: [go-nuts] When would you use single quotes?

2019-02-06 Thread Wagner Riffel
'⌘' is of type rune (aka int32), "⌘" and `⌘` are of type string, both takes more than 3 bytes. -- 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

[go-nuts] When would you use single quotes?

2019-02-06 Thread mr . jamie . caldwell
Hello, I'd be grateful if someone could please explain why you would use r := '⌘' Instead of s := "⌘" / s:= `⌘` All use three bytes ...? Thank you, Jamie. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and