Hi, I read about inout functions in the language documentation which allows to use inout in order to set the constness of the return type based on the constness of some argument. What is not mentioned is that this also works for the this-reference by marking the function itself inout:
So instead of class C { OtherClass foo; const(OtherClass) getOther() const { return foo; } OtherClass getOther() { return foo; } } we can write class C { OtherClass foo; inout(OtherClass) getOther() inout { return foo; } } Since the documentation only talks about marking arguments inout, can I nevertheless rely on its behavior? Anyways, I think it is worth to be included in the docs. Best regards, Matthias