What are some ways to get more strict type-checking?
Devin
lee.hastings at outlook.com
Tue May 7 13:46:55 UTC 2019
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.
More information about the Digitalmars-d-learn
mailing list