Re: Question on Immutability

2021-09-01 Thread Merlin Diavova via Digitalmars-d-learn
Goal achieved! Thanks all, really appreciate the assistance.

Re: Question on Immutability

2021-08-31 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 31 August 2021 at 06:15:07 UTC, jfondren wrote: On Tuesday, 31 August 2021 at 05:42:22 UTC, ag0aep6g wrote: On 31.08.21 02:50, Mike Parker wrote: Member functions marked as immutable can be called on both mutable and immutable instances. That's not true. Demonstrated: Well

Re: Question on Immutability

2021-08-31 Thread jfondren via Digitalmars-d-learn
On Tuesday, 31 August 2021 at 05:42:22 UTC, ag0aep6g wrote: On 31.08.21 02:50, Mike Parker wrote: Member functions marked as immutable can be called on both mutable and immutable instances. That's not true. Demonstrated: ```d struct S { int x; int get() immutable { return x; } }

Re: Question on Immutability

2021-08-30 Thread ag0aep6g via Digitalmars-d-learn
On 31.08.21 02:50, Mike Parker wrote: Member functions marked as immutable can be called on both mutable and immutable instances. That's not true.

Re: Question on Immutability

2021-08-30 Thread Mike Parker via Digitalmars-d-learn
On Monday, 30 August 2021 at 23:27:07 UTC, Merlin Diavova wrote: ``` After playing around the above works, Great! However I have some questions First, why do the interfaces have to be defined as `immutable interface`? The interfaces cannot be changed at runtime or instantiated. It isn't

Re: Question on Immutability

2021-08-30 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Aug 30, 2021 at 11:27:07PM +, Merlin Diavova via Digitalmars-d-learn wrote: > Hi All, > > I'm trying to understand immutability in D and it seems a bit odd. > I'm coming from dynamic languages so please forgive my ignorance and > dynamic language-isms. > > I want to have a base