Re: [go-nuts] Space-optimization question

2018-09-05 Thread Dan Kortschak
A minor modification to that; if the const declaration is done as shown here https://play.golang.org/p/CkztBS-Wkvm you get the constants rendered near the type rather than at the top of the godoc page. On Thu, 2018-09-06 at 09:58 +1000, Nigel Tao wrote: > You can implement a String method on that

Re: [go-nuts] Space-optimization question

2018-09-05 Thread Nigel Tao
On Thu, Sep 6, 2018 at 12:22 AM Eric Raymond wrote: > Matters in my case because the deserialization of a repository history can > contain hundreds of thousands of constants like "M", "D", "R", and "C" > representing fast-export stream file operation types. I could intern them > explicitly but

Re: [go-nuts] Space-optimization question

2018-09-05 Thread Eric Raymond
On Wednesday, September 5, 2018 at 10:38:16 AM UTC-4, Jan Mercl wrote: > > On Wed, Sep 5, 2018 at 4:23 PM Eric Raymond > wrote: > > > Matters in my case because the deserialization of a repository history > can contain hundreds of thousands of constants like "M", "D", "R", and "C" > > represent

Re: [go-nuts] Space-optimization question

2018-09-05 Thread Jan Mercl
On Wed, Sep 5, 2018 at 4:23 PM Eric Raymond wrote: > Matters in my case because the deserialization of a repository history can contain hundreds of thousands of constants like "M", "D", "R", and "C" > representing fast-export stream file operation types. I could intern them explicitly but it avoi

Re: [go-nuts] Space-optimization question

2018-09-05 Thread Eric Raymond
On Wednesday, September 5, 2018 at 10:12:51 AM UTC-4, Jan Mercl wrote: > > On Wed, Sep 5, 2018 at 4:00 PM Eric Raymond > wrote: > > > If I have multiple occurrences of a string constant in source code - > say, "M" - can I count on the compiler to create one static instance and > pass reference

Re: [go-nuts] Space-optimization question

2018-09-05 Thread Jan Mercl
On Wed, Sep 5, 2018 at 4:00 PM Eric Raymond wrote: > If I have multiple occurrences of a string constant in source code - say, "M" - can I count on the compiler to create one static instance and pass references to it everywhere? It's unspecified, so strictly speaking you cannot. (Also, everythin