On Fri, Feb 20, 2015 at 7:10 PM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote: > Hi Crypto, > > On Fri, Feb 20, 2015 at 11:02 PM, Crypto Compress < > cryptocompr...@googlemail.com> wrote: > >> AssertionExceptions are not intended to be caught, they are intended to be >>> seen, in a specific environment. >>> >> >> Joe, your argumentation is around how (not) to use exceptions. I can see >> your point and it's valid. >> My point is about not to implement exceptions at all. >> >> If exceptions are not intended to be caught, they don't need to be thrown >> (even if the context is different). >> If exceptions are not thrown and not caught, we can use "error" in dev and >> some easing severity (warning, zero cost nothing) in prod. >> >> Freely adapted from Murphy: If assertion exception can be catched, it will >> be even in production. > > > Assertion is only for development and testing. > We need errors or exceptions during development and testing, but > not in production. Therefore, errors/exception should not be catched > by code in general. Isn't assertion nature? > > I don't insist not to enable assertion in production environment. > There might be software that needs extreme reliability and stability. > For these softwares, it makes sense to enable assertions and catch > errors/exceptions to do some cleanups.
This last paragraph makes me wonder why in the world assert in PHP is still anything valid. If anything it should be removed, to be honest. Which softwares do not require to be reliable and stable? Most if not all PHP written software interact with external inputs, be from APIs point of view or from actual users. Per se, they have to be validated and errors handling is part of this validation. I do see some values for asserts in unit tests, but that's pretty much all I can think about it. All in all, I stay with my initial comment, this RFC needs more discussion and some other critical questions must be answered before this RFC. Cheers, -- Pierre @pierrejoye | http://www.libgd.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php