Interested in D, spec confuses me.

IceCreamEater via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 2 13:35:13 PST 2016


On Tuesday, 2 February 2016 at 20:17:20 UTC, H. S. Teoh wrote:
> On Tue, Feb 02, 2016 at 09:13:41PM +0100, anonymous via 
> Digitalmars-d wrote: [...]
>> The other signature is no different. Two occurrences of 
>> "immutable", applying to two different things.
>> 
>> I agree that it can be unclear to newbies what exactly is 
>> immutable when a method is marked immutable, but the meaning 
>> of the keyword is the same as elsewhere. Using another word 
>> there would be more confusing.
>
> Another way to think about it, is that the "immutable" on the 
> function means that the implicit `this` reference to the object 
> is immutable.
>
>
> T

I thought immutable was added to the language as a better 
guarantee to 'const'. Which really tells me const wasn't cutting 
it and wasn't a proper guarantee.


More information about the Digitalmars-d mailing list