Re: Is it a good idea to have a "strict" mode?

From: Date: Fri, 30 Jan 2015 09:43:04 +0000
Subject: Re: Is it a good idea to have a "strict" mode?
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-81410@lists.php.net to get a copy of this message
Hi, > On 30 Jan 2015, at 09:14, Florian Anderiasch <ml@anderiasch.de> wrote: > > > >> On 01/30/2015 06:36 AM, Yasuo Ohgaki wrote: >> Hi Cesar, >> >>> On Fri, Jan 30, 2015 at 2:16 PM, César Rodas <cesar@rodas.me> wrote: >>> >>> I'm wondering if it would be a good idea to have a >>> strict mode in PHP. >>> Many language have them and it is a good idea. >>> >>> I think it should be a bit different in PHP, it should encourage the >>> following things: >>> >>> - Avoid deprecated things, it should throw an exception. >>> - Avoid explicit conversions of undefined constants to strings. >>> - Anything else that could make run-time slower *or* bad practice. >>> >>> ```php >>> "use strict"; >>> >>> var_dump(FOOBAR); // should throw an exception, undefined constant. >>> ``` >> >> We have error_reporting INI for this purpose. >> Users may be strict or lazy for errors by the INI setting. > > I don't think it's a good idea to have a strict mode at all. I'd prefer > any language to be strict and unambiguous enough from the start. Adding > strict mode after the fact is just a band aid. PHP's error reporting > level isn't that bad, but if you're ignoring legacy code there's hardly > a reason not to develop to the strictest standard possible. > > ~Florian > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > I agree. Use error handlers. -- Andrea Faulds http://ajf.me/

« previous php.internals (#81410) next »