On Friday, 31 July 2015 at 17:21:40 UTC, Ali Çehreli wrote:
On 07/26/2015 04:29 AM, Joseph Rushton Wakeling via Digitalmars-d-learn wrote:

> is this design idea even feasible in principle, or just a bad
> idea from the get-go?

As I understand it, it is against one of fundamental D principles: structs are value types where any copy can be used in place of any other.

I expect there are examples where even Phobos violates it but the struct documentation still says so: "A struct is defined to not have an identity; that is, the implementation is free to make bit copies of the struct as convenient."

I believe this restriction should be banned. Considering classes have inherent reference + heap semantics (and you can only bail out of that with hacks) saying struct can't be anything but data bags makes impossible to implement whole class of useful designs.

The fact that Phobos has to violate it itself to get stuff done is quite telling.

Reply via email to