4 ms·
golang has a wonderful solution
by aliqot 4y ago
golang has a wonderful solution
- maxbond 4y agoWould you care to elaborate on what it is and why it's better for the benefit of those of us who don't know Go? It's tricky to look up a different solution you aren't familiar since the terminology is different. What I'm seeing currently doesn't really look that different to Python, but with different names for the types and such. Taking a stab at it; This looks simple, and runes are great (similar to Python): https://golangdocs.com/strings-in-golang https://golangdocs.com/strings-in-golang But something that bothers me is that converting an array of bytes to a string looks to implicitly be ASCII, or possibly UTF8. This document doesn't say. This document acknowledges encodings and clarifies that literals are UTF8, but makes no mention of byte arrays: https://go.dev/blog/strings https://go.dev/blog/strings I've poked through as many SO questions as I care to and am not clear on how to use different encodings. Looks to me like this is a difference in philosophy; Python would say, explicit is better then implicit, and I'm inclined to agree. If I'm not understanding properly I'm happy to be corrected.