Re: [go-nuts] Enforce immutability through static analysis

2019-11-22 Thread Paul Jolly
May or may not be of interest, but I experimented with an alternative approach in https://github.com/myitcv/x/blob/master/immutable/_doc/immutableGen.md Although this is where the term "immutable" gets massively overloaded, because the result of immutableGen is (as I understand it) persistent

Re: [go-nuts] Enforce immutability through static analysis

2019-11-22 Thread Robert Engels
I don't think anyone was mocking the question or thought it was ridiculous.-Original Message- From: Robert Johnstone Sent: Nov 22, 2019 8:40 AM To: golang-nuts Subject: Re: [go-nuts] Enforce immutability through static analysis This comment is a little unfair.  There was at one time

Re: [go-nuts] Enforce immutability through static analysis

2019-11-22 Thread Robert Johnstone
t; -Original Message- > > >From: burak serdar > > > >Sent: Nov 21, 2019 11:34 AM > > >To: Robert Engels > > > >Cc: advand...@gmail.com , golang-nuts < > golan...@googlegroups.com > > > >Subject: Re: [go-nuts] Enforce immutabili

Re: [go-nuts] Enforce immutability through static analysis

2019-11-22 Thread Ad van der Veer
t; > > >The way I read the original post what is being asked is, is it > >possible to have the Go-equivalent of the following C++ code: > > > >class X{ > > public: > > virtual int f() const =0; > >} > > > > > >> > >> > >> > >> -Original

Re: [go-nuts] Enforce immutability through static analysis

2019-11-21 Thread Robert Engels
X{ > public: > virtual int f() const =0; >} > > >> >> >> >> -Original Message- >> >From: burak serdar >> >Sent: Nov 21, 2019 11:34 AM >> >To: Robert Engels >> >Cc: advanderv...@gmail.com, golang-nuts >> >Su

Re: [go-nuts] Enforce immutability through static analysis

2019-11-21 Thread burak serdar
2019 11:34 AM > >To: Robert Engels > >Cc: advanderv...@gmail.com, golang-nuts > >Subject: Re: [go-nuts] Enforce immutability through static analysis > > > >On Thu, Nov 21, 2019 at 10:25 AM Robert Engels wrote: > >> > >> I don't think we are talking

Re: [go-nuts] Enforce immutability through static analysis

2019-11-21 Thread Robert Engels
t;Sent: Nov 21, 2019 11:34 AM >To: Robert Engels >Cc: advanderv...@gmail.com, golang-nuts >Subject: Re: [go-nuts] Enforce immutability through static analysis > >On Thu, Nov 21, 2019 at 10:25 AM Robert Engels wrote: >> >> I don't think we are talking about the s

Re: [go-nuts] Enforce immutability through static analysis

2019-11-21 Thread burak serdar
achable from the copy of the receiver. > > > > > -Original Message- > >From: burak serdar > >Sent: Nov 21, 2019 11:09 AM > >To: Robert Engels > >Cc: advanderv...@gmail.com, golang-nuts > >Subject: Re: [go-nuts] Enforce immutability through stati

Re: [go-nuts] Enforce immutability through static analysis

2019-11-21 Thread Robert Engels
c: advanderv...@gmail.com, golang-nuts >Subject: Re: [go-nuts] Enforce immutability through static analysis > >On Thu, Nov 21, 2019 at 10:05 AM Robert Engels wrote: >> >> To clarify - the author of the package enforces immutability. With Go’s >> design this can be a simple comm

Re: [go-nuts] Enforce immutability through static analysis

2019-11-21 Thread burak serdar
riginal Message- > >> From: burak serdar > >> Sent: Nov 21, 2019 10:53 AM > >> To: Robert Engels > >> Cc: advanderv...@gmail.com, golang-nuts > >> Subject: Re: [go-nuts] Enforce immutability through static analysis > >> > >>>

Re: [go-nuts] Enforce immutability through static analysis

2019-11-21 Thread Robert Engels
is mutating it, then it is not an > immutable object. > > > > > -Original Message- >> From: burak serdar >> Sent: Nov 21, 2019 10:53 AM >> To: Robert Engels >> Cc: advanderv...@gmail.com, golang-nuts >> Subject: Re: [go-nuts] Enforce

Re: [go-nuts] Enforce immutability through static analysis

2019-11-21 Thread Robert Engels
t;package as the type, so all fields are visible to the receiver. > > >> >> -Original Message- >> From: advanderv...@gmail.com >> Sent: Nov 21, 2019 10:15 AM >> To: golang-nuts >> Subject: [go-nuts] Enforce immutability through static analysis >> &g

Re: [go-nuts] Enforce immutability through static analysis

2019-11-21 Thread burak serdar
receiver. > > -Original Message- > From: advanderv...@gmail.com > Sent: Nov 21, 2019 10:15 AM > To: golang-nuts > Subject: [go-nuts] Enforce immutability through static analysis > > Dear Gophers! > > I was wonder if it possible to force immutability on the method

Re: [go-nuts] Enforce immutability through static analysis

2019-11-21 Thread Robert Engels
They can't unless the instance field is exported. Just hide it via encapsulation with accessors.-Original Message- From: advanderv...@gmail.com Sent: Nov 21, 2019 10:15 AM To: golang-nuts Subject: [go-nuts] Enforce immutability through static analysis Dear Gophers!I was wonder

[go-nuts] Enforce immutability through static analysis

2019-11-21 Thread advanderveer
Dear Gophers! I was wonder if it possible to force immutability on the method receiver? I know Go doesn't support immutable types and that it is possible to pass the receiver by value but if the receiver struct has a field with a pointer type the method may still manipulate it: type Counter