On Sun, Jan 30, 2022 at 5:41 PM Christian Schneider <cschn...@cschneid.com> wrote:
> Am 30.01.2022 um 16:55 schrieb Nikita Popov <nikita....@gmail.com>: > > Something I want to add here is that there is also an important technical > > motivation behind promoting undefined variable notices to exceptions: The > > big problem with these (from a pure implementation perspective) is that > we > > need to throw the warning and continue running. But the warning might > call > > a custom error handler, which may modify state that the virtual machine > > does not expect to be modified. The PHP VM plays increasingly complex > games > > to prevent this, but despite all that complexity, this problem cannot be > > fully solved while this remains a warning, rather than an exception. > > > Just so it has been mentioned: This could also be addressed by removing > the warning (-:C > > Out of curiosity: If undefined variables would be turned into exceptions, > is the fact that now almost every operation can throw an exception that > much easier to handle? > Almost every operation can *already* throw an exception -- if something throws a warning, then that warning may be promoted to an exception by a custom error handler. But yes, dealing with exceptions is much simpler, because they abort control flow. Regards, Nikita