Hi David,

Firstly, I agree with Nikita's general rule of which Warnings should be
promoted and which need deeper thought.

I would like to challenge one assertion in your e-mail, which is related to
that thought process:


On Mon, 21 Oct 2019 at 14:52, David Negrier <d.negr...@thecodingmachine.com>
wrote:

> We would be happy to promote more warnings to exceptions as those:
> - are more predictable
> - can be more easily caught / handled
>


I have always thought, and continue to think, that converting all Warnings
(and Notices) to Exceptions is inappropriate, because Exceptions have some
very specific behaviours, which are not always desirable:

- They immediately jump control out of the current frame of execution.
Unless you put a separate "try-catch" around every line, there is no
"acknowledge and run next line".
- Their default behaviour if not handled is to completely terminate
whatever is happening, right up to showing a blank white screen.

There is no general way to know whether the result of aborting execution
completely is better or worse than carrying on with unexpected values. In a
program that's not expecting it, either one could lead to data loss or
corruption.

There are definitely places where a Warning can reasonably be converted to
an Exception; but I don't think this should be done as some kind of bulk
change. Each Warning we promote should have at least one person answer the
question "is it likely that terminating processing when this happens at
run-time will be better than flagging a Warning and returning a defined
value?"

Regards,
-- 
Rowan Tommins
[IMSoP]

Reply via email to