How to disable assigning a value to a property?

Dennis dkorpel at gmail.com
Tue Jul 6 10:25:28 UTC 2021


On Tuesday, 6 July 2021 at 10:06:11 UTC, Jack Applegame wrote:
> How to disable `register.clock = 10;` but allow 
> `register.clock(1) = 10;`?
> I want to get a compilation error on `register.clock = 10;`

We're [still awaiting formal assessment on 
dip1038](https://forum.dlang.org/thread/sojvxakgruzfvbigzhiu@forum.dlang.org), but if that gets in, you can mark `clock` or `Field` `@nodicard`. Otherwise I don't know of a way.


More information about the Digitalmars-d-learn mailing list