On Monday, 12 November 2012 at 22:44:22 UTC, Jonathan M Davis
wrote:
On Monday, November 12, 2012 23:01:22 Tommi wrote:
NOTE: All of the above assumes that D were designed so that all
types had value semantics.
Which will never happen. So, any discussion based on that
premise is pretty pointless. And this discussion would
never have happened in the first place if D had no reference
types, because you'll never have a transient front with a value
type.
Oh, it was just a matter of miscommunication then. I bet you
missed the following post of mine, which made it clear that I
wasn't suggesting a solution, but simply dreaming of a better
language design (like I usually am):
On Monday, 12 November 2012 at 08:37:20 UTC, Tommi wrote:
Now I finally see that deepDup/deepCopy/clone is not a (good)
solution, because it would be inefficient in a lot of
situations. This whole mess makes me wish that D was designed
so that all types had value semantics (by convention, since
it's probably not possible to enforce by the language).
That would mean:
1) No classes. Just duck-typing based polymorphism à la go
language.
2) Dynamic arrays of mutable types would have had to been
implemented as copy-on-write types à la Qt containers.
Don't know about the performance implications of COW though.
I may throw these wild ideas around, but I don't do it in order
to have them implemented by D, but so that some-one could crush
those ideas with counter-arguments. But yeah, this would be a
wrong thread to have that discussion anyway.