On Fri, Mar 12, 2021 at 12:51 PM Kevin Chadwick <m8il1i...@gmail.com> wrote:

> I would argue that a string could be nil but isn't and that being 0 len is
> a
> good thing. Ergo, it is strange for a map to be doing premature
> optimisation,
> when you could test it for 0 size. More likely, it is an artifact of make
> coming
> to the language later on and perhaps is tied by the go promise,
> unfortunately?
> It might have also been a not tiny amount of work for a relatively small
> benefit.
>

This sounds like if you are suggesting to make the zero value of a map an
empty map, which is different from initializing a map variable to an empty
map if it a named return. That suggestion has come up a lot, both on this
list and on the github issue tracker. It's, unfortunately, not as easy as
it sounds. Here is some prior discussion:
https://groups.google.com/g/golang-nuts/c/SjuhSYDITm4/m/Z013vH5qDQAJ
https://groups.google.com/g/golang-nuts/c/5_8E9OblIho/m/b9O038mzBQAJ

Are there any better tools than golang-shadow and golang-nilness, for these
> problems?


I don't know. I don't even know either of those.


> --
> 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 golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/d89835e2-4db3-e34e-416c-a7db6d472a79%40gmail.com
> .
>

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfF%3DJO6026QwgCi84-QwAFVgibq3DeJCAfz9wmwB21zH5Q%40mail.gmail.com.

Reply via email to