DIP 1008 Preliminary Review Round 1

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri May 19 10:05:09 PDT 2017


On Fri, May 19, 2017 at 05:13:34PM +0100, rikki cattermole via Digitalmars-d wrote:
[...]
> "Code that needs to leak the thrown exception object can clone the
> object."
> 
> Errors:
> ```D
> import std.stdio;
> void main() {
> 	auto e = new Exception("foo");
> 	e = e.dup;
> 	writeln(e.toString());	
> }
> ```
> 
> Let's just say, I am unaware of a way to duplicate classes. Assuming
> I'm messing something, a code example would be very appreciated in the
> DIP.

AFAIK, there is no way to clone classes, unless the class writer
implemented it explicitly. Only arrays support .dup, no other type does
(unless user code explicitly implements it, or its equivalent).


T

-- 
This is not a sentence.


More information about the Digitalmars-d mailing list