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
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
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
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
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
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
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
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
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
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
> >>
> >>>
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
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
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
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
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
15 matches
Mail list logo