Re: [go-nuts] package-level structs vs package-level vars

2019-08-04 Thread Robert Engels
I would assume so. That is the advantage of Go compared to others in that is has value objects. Someone else can confirm. > On Aug 4, 2019, at 9:52 PM, burak serdar wrote: > >> On Sun, Aug 4, 2019 at 8:14 PM B Carr wrote: >> >> >> Would that be where structs live as well? > > Any global va

Re: [go-nuts] package-level structs vs package-level vars

2019-08-04 Thread burak serdar
On Sun, Aug 4, 2019 at 8:14 PM B Carr wrote: > > > Would that be where structs live as well? Any global variable, struct or not, would be in the data section. For interfaces/pointers, the variable itself will be in the data section, but where it points may be in the heap. Any variable you declar

Re: [go-nuts] package-level structs vs package-level vars

2019-08-04 Thread B Carr
Would that be where structs live as well? On Sunday, August 4, 2019 at 6:25:55 PM UTC-6, Robert Engels wrote: > > I’m pretty sure they will be in the data section, for non > interface/pointer types which is even better than the stack. > -- You received this message because you are subscribed

Re: [go-nuts] package-level structs vs package-level vars

2019-08-04 Thread Robert Engels
I’m pretty sure they will be in the data section, for non interface/pointer types which is even better than the stack. > On Aug 4, 2019, at 7:16 PM, burak serdar wrote: > >> On Sun, Aug 4, 2019 at 6:06 PM Robert Engels wrote: >> >> Just because you declare in functions and pass around does n

Re: [go-nuts] package-level structs vs package-level vars

2019-08-04 Thread burak serdar
On Sun, Aug 4, 2019 at 6:06 PM Robert Engels wrote: > > Just because you declare in functions and pass around does not have anything > to do if it will be on the heap or the stack. It depends on if the compiler > can detect if the object does not “escape”. Right. However, if the variables are d

Re: [go-nuts] package-level structs vs package-level vars

2019-08-04 Thread Robert Engels
Just because you declare in functions and pass around does not have anything to do if it will be on the heap or the stack. It depends on if the compiler can detect if the object does not “escape”. > On Aug 4, 2019, at 5:35 PM, burak serdar wrote: > >> On Sun, Aug 4, 2019 at 11:19 AM B Carr w

Re: [go-nuts] package-level structs vs package-level vars

2019-08-04 Thread burak serdar
On Sun, Aug 4, 2019 at 11:19 AM B Carr wrote: > > Concept observation. Could use some amplification from the congregants, > please... > > I'm learning about Go. > > My webserver program had lots of package level vars and only two, small > structs. I set a dozen webpages to refresh very busy data

[go-nuts] package-level structs vs package-level vars

2019-08-04 Thread B Carr
Concept observation. Could use some amplification from the congregants, please... I'm learning about Go. My webserver program had lots of package level vars and only two, small structs. I set a dozen webpages to refresh very busy data calculations every 6 seconds. Over the course of an hour, l