head const (again), but for free?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Wed Jan 13 19:22:07 UTC 2021


On Wednesday, 13 January 2021 at 18:37:02 UTC, sighoya wrote:
> Yep, head const is usually readonly or better final, readonly 
> should be transitive.

Why? "immutable" is transitive in D. readonly memory or registers 
are not transitive.


> I just find it confusing to denote readonly as head immutable 
> because readonly in other languages denote head const, that's 
> it.

No, readonly in technical specifications usually means that it is 
isn't possible to write to it at all. e.g. readonly hardware 
registers. They can still point to writable memory.

"readonly" in Typescript and C# is immutable, not const.

Which languages are you thinking of?



More information about the Digitalmars-d mailing list