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 dat

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

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
a concern outside the package, and that is > clearly supported. > > > >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; > >} > > > >

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

2019-11-21 Thread Robert Engels
following C++ code: > >class X{ > public: > virtual int f() const =0; >} > > >> >> >> >> -Original Message- >> >From: burak serdar >> >Sent: Nov 21, 2019 11:34 AM >> >To: Robert Engels >> >Cc: advanderv...@gmai

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

2019-11-21 Thread burak serdar
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 t

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

2019-11-21 Thread Robert Engels
urak serdar >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 ta

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

2019-11-21 Thread burak serdar
y values reachable 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 immutabilit

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

2019-11-21 Thread Robert Engels
els >Cc: 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 s

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
>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 &

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

2019-11-21 Thread burak serdar
ble 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 > > Dear Gophers! > > I was wonder if it possible to force immutability on

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 st