On 2011-09-25 02:52:47 +0000, Andrei Alexandrescu
<[email protected]> said:
On 9/24/11 9:31 PM, Michel Fortin wrote:
Perhaps I am missing the point. What would be gained by forcing
this(this) to be nothrow?
It further frees the standard library to cater for the throwing case.
Concretely, what does it simplifies?
Does it only simplifies the documentation of algorithms? … in that most
algorithms doing copies should mention that throwing during copy may
leave some mutated data structure in some kind of a half processed
state. I don't think that would surprise anyone.
That said, I would certainly recommend not throwing inside this(this),
but I don't think this recommendation should be enforced by the
language. I think forcing it to be nothrow would encourage people to
silently ignore exceptions with try {…} catch (…) {}. Unless you catch
all exceptions like that, nothrow will prevent you from calling many
functions which could be reasonable to call otherwise, such as writeln,
or from incrementing a reference counter checking for overflow.
--
Michel Fortin
[email protected]
http://michelf.com/