proposal for general dup function
Jacob Carlborg
doob at me.com
Mon Dec 10 11:54:46 PST 2012
On 2012-12-10 20:46, Andrei Alexandrescu wrote:
> Just like Dan I thought it can be done but actually ownership is
> impossible to establish in general. Consider:
>
> class List(T) {
> List next;
> T payload;
> ...
> }
>
> versus
>
> class Window {
> Window parent;
> ...
> }
>
> It's pretty obvious from the name that duplicating a List would entail
> duplicating its tail, whereas duplicating a Window would entail just
> copying the reference to the same parent. However, at the type level
> there's no distinction between the two members.
I'm not sure, why wouldn't you want to copy the parent window as well?
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list