Re: Object.dup?

2021-08-31 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 30 August 2021 at 20:32:28 UTC, Adam D Ruppe wrote: You can define one yourself of course with overrides in child classes to update those kinds of things. But doing it automatically is tricky. Yes, thanks. I was interested in the possibility of a single non-member function,

Re: Object.dup?

2021-08-30 Thread Adam D Ruppe via Digitalmars-d-learn
On Monday, 30 August 2021 at 20:21:38 UTC, Per Nordlöw wrote: Why doesn't `Object` have an auto-defined `.dup` property? I don't think it could. What if you have a child class with a delegate that points to one of its own methods? You can define one yourself of course with overrides in

Object.dup?

2021-08-30 Thread Per Nordlöw via Digitalmars-d-learn
Why doesn't `Object` have an auto-defined `.dup` property? It would be useful when dealing with, for instance, handling of `Throwable`'s in multi-threaded contexts.

Re: deep copying / .dup / template object.dup cannot deduce function from argument types

2015-12-14 Thread rumbu via Digitalmars-d-learn
On Sunday, 13 December 2015 at 18:54:24 UTC, Robert M. Münch wrote: Hi, I just wanted to naively copy an object and used: a = myobj.dup; [...] A naive clone method for objects: https://github.com/rumbu13/sharp/blob/c34139449a078618e807a3f206541656df1bea6a/src/system/package.d#L46

deep copying / .dup / template object.dup cannot deduce function from argument types

2015-12-13 Thread Robert M. Münch via Digitalmars-d-learn
Hi, I just wanted to naively copy an object and used: a = myobj.dup; and get the following error messages: source/app.d(191): Error: template object.dup cannot deduce function from argument types !()(BlockV), candidates are: /Library/D/dmd/src/druntime/import/object.d(1872):object.dup

Re: deep copying / .dup / template object.dup cannot deduce function from argument types

2015-12-13 Thread Alex Parrill via Digitalmars-d-learn
On Sunday, 13 December 2015 at 18:54:24 UTC, Robert M. Münch wrote: Hi, I just wanted to naively copy an object and used: a = myobj.dup; and get the following error messages: source/app.d(191): Error: template object.dup cannot deduce function from argument types !()(BlockV), candidates