On 8/23/18 12:27 PM, Shachar Shemesh wrote:
On 23/08/18 17:01, Steven Schveighoffer wrote:
So interestingly, you are accepting the sockaddr by VALUE.

Indeed. The reason is that I cannot accept them by reference, as then you wouldn't be able to pass lvalues* in. Another controversial decision by D.

*rvalues you meant.

One that is actively being addressed, at least by the community: https://github.com/dlang/DIPs/blob/master/DIPs/DIP1016.md

No guarantees it gets through, but this is probably further than anyone has ever gotten before on this topic (and it's a very old topic).


Had that been C++, I'd definitely get a const ref instead.

If you want to use inheritance this is a given, in D or in C++.

What this simply means is your identification of the problem is simply wrong -- it's not that you can't make subtypes with structs (you can), it's that you can't accept rvalues by reference, and accepting by reference is required for inheritance.

-Steve

Reply via email to