Does it have to allocate though? It doesn't close over anything and funcs can no ...
13 years, 1 month ago
(2012-03-01 17:17:08 UTC)
#3
Does it have to allocate though? It doesn't close over anything and funcs
can no longer ==. The compiler could generate this once, right?
On Mar 1, 2012 8:19 AM, "Russ Cox" <rsc@golang.org> wrote:
> This is an unfortunate example, because it allocates the closure on each
> run.
> Better to use a function.
>
On Thu, Mar 1, 2012 at 12:17, Brad Fitzpatrick <bradfitz@google.com> wrote: > Does it have ...
13 years, 1 month ago
(2012-03-01 17:18:23 UTC)
#4
On Thu, Mar 1, 2012 at 12:17, Brad Fitzpatrick <bradfitz@google.com> wrote:
> Does it have to allocate though? It doesn't close over anything and funcs
> can no longer ==. The compiler could generate this once, right?
It does, now, but having to explain that distracts from the example.
*** Submitted as http://code.google.com/p/go/source/detail?r=096c7653c6b5 *** sync: add Once example R=golang-dev, rsc, bradfitz CC=golang-dev http://codereview.appspot.com/5715046
13 years, 1 month ago
(2012-03-01 18:16:25 UTC)
#7
Issue 5715046: code review 5715046: sync: add Once example
(Closed)
Created 13 years, 1 month ago by dvyukov
Modified 13 years, 1 month ago
Reviewers:
Base URL:
Comments: 0