opDispatch and alias this
IgorStepanov
is at kalabi.ru
Tue Jun 26 02:01:18 UTC 2018
On Tuesday, 26 June 2018 at 00:56:13 UTC, Jonathan M Davis wrote:
> On Monday, June 25, 2018 23:13:12 Seb via Digitalmars-d wrote:
> - Jonathan M Davis
I've tried to fix this issue. If briefly there is one collision:
Final alias this should be r-value:
static struct S
{
int i;
}
void test(ref S s) {}
auto val = Final!S(42);
assert (!__traits(compiles, test(val))); //val works as r-value
However should be able to mutate fields of val:
val.i = 24;
assert(val.i == 24); //should works
We may discard this case: for struct is value-type and head const
should disable changing of fields. For example in C++ you can't
declare instance of struct when you can not reassign instance,
but can reassign a field.
More information about the Digitalmars-d
mailing list