Re: [PHP-DEV] Changing default assertion mode to throw exceptions

This is only part of a thread. view whole thread
  111075
July 20, 2020 13:48 internals@lists.php.net ("Levi Morrison via internals")
On Mon, Jul 13, 2020 at 11:37 AM Levi Morrison <levim@php.net> wrote:
> > Hello everyone, > > I'd like to change the default mode of assertion failures to throw. > The current default is to warn. In my opinion this is a bad strategy: > the engine asserted that something that is expected to be true is not, > so executing further is a bad idea. This leaves throwing or bailing > out. I think throwing an exception is better than bailing out, so > that's what I propose.
Hello, everyone. It's been a week and I have only heard a bit of positive feedback and no pushback. Anyone else want to reply?
  111100
July 22, 2020 08:48 brendt@stitcher.io (Brent Roose)
Hi Levi

I personally almost never use assert, and actually assumed it would throw an error, so this sounds like a good change! 

Have you done research on how this would affect the top-1000-ish popular packages like Nikita does?

Kind regards
Brent

> On 20 Jul 2020, at 15:48, Levi Morrison via internals <internals@lists.php.net> wrote: > > On Mon, Jul 13, 2020 at 11:37 AM Levi Morrison <levim@php.net> wrote: >> >> Hello everyone, >> >> I'd like to change the default mode of assertion failures to throw. >> The current default is to warn. In my opinion this is a bad strategy: >> the engine asserted that something that is expected to be true is not, >> so executing further is a bad idea. This leaves throwing or bailing >> out. I think throwing an exception is better than bailing out, so >> that's what I propose. > > Hello, everyone. It's been a week and I have only heard a bit of > positive feedback and no pushback. Anyone else want to reply? > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php >