Crow programming language

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Fri Feb 16 01:26:42 UTC 2024


On 16/02/2024 12:46 PM, andy wrote:
>     If you make global variables |immutable|, you can access them in
>     |pure| functions.
> 
> Is it as simple as that? I'd have to cast away the |immutable| when 
> adding a new interned string though. Is that still the correct way to do it?

No.

It was never correct.

Immutable is a very strong guarantee that the memory will never change.

The compiler in such a case is free to put it into read only memory and 
as a result crash if you tried to write to it.

You can use const instead which doesn't have any such guarantees and 
it'll work with a pure function :)


More information about the Digitalmars-d-announce mailing list