On 25 September 2017 at 17:43, Amnon Baron Cohen <amno...@gmail.com> wrote:

> https://github.com/golang/go/issues/2632
>

Nice link, fun to see that all this discussion has happened before (and no
doubt, will happen again!).

Reading that thread and related threads, I get the impression that there is
not an open issue covering string([]byte) where the []byte can be proven to
not be mutated. At least not one that is cross referenced (or I may have
missed it with my quick scanning).

Russ did comment (https://github.com/golang/go/
issues/2632#issuecomment-252725945) that he would prefer to see the
compiler improved, but I didn't find an open issue which covers that. Can
anyone else find one? I think there are some valuable insights in the
linked issue, though it is closed because it proposes API duplication
rather than an underlying compiler fix.

For fun I did an AST search of string(thing of type []byte) in the Go
corpus. It comes a fair amount. Not sure though how to evaluate the
performance impact of fixing it. Would be nice if it were a simple matter
of running everyone's code to find out ;-). Anecdotally it appears in some
hot loops for me, and maybe it's interesting that other people have
discussed it quite a bit (quoting Bradfitz Oct 2015: "4 years and still a
problem": https://github.com/golang/go/issues/2632#issuecomment-144591243)

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to