On Monday, 6 May 2019 at 14:41:31 UTC, Adam D. Ruppe wrote:
struct ID { private uint handle_; @property uint handle() { return handle_; } alias handle this; // now aliased to a property getter // so it won't allow modification through that/ }
This seems like a good solution! I was aware that making an alias didn't actually enforce any type-checking, but I wasn't sure how to make something like this without it being really verbose.