seeking advice: possible new @attribute to mark class' default property to avoid alias this ?
rikki cattermole
rikki at cattermole.co.nz
Sun Aug 8 04:30:12 UTC 2021
So a field that will automatically be resolved to as part of the
behavior of generated toString methods.
That really isn't what alias this is used for commonly. I.e.
struct ValueReference {
private {
SomethingElse* impl;
}
bool isNull() { return impl is null; }
scope ref ValueType _get() { return impl.thingy; }
alias _get this;
}
Only the problem is, this also works for classes and whole pile of extra
cases.
More information about the Digitalmars-d-learn
mailing list