Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81410 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6338 invoked from network); 30 Jan 2015 09:43:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jan 2015 09:43:16 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.199 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.199 imap11-2.ox.privateemail.com Received: from [192.64.116.199] ([192.64.116.199:54338] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C5/D1-31101-2325BC45 for ; Fri, 30 Jan 2015 04:43:15 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id AF5328800D5; Fri, 30 Jan 2015 04:43:09 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap11.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap11.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id BPhk1Oyjz4xD; Fri, 30 Jan 2015 04:43:07 -0500 (EST) Received: from [137.50.172.223] (oa-edu-172-223.wireless.abdn.ac.uk [137.50.172.223]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 5990B8800EB; Fri, 30 Jan 2015 04:43:06 -0500 (EST) References: <54CB13A4.9060900@rodas.me> <54CB4B70.6060900@anderiasch.de> Mime-Version: 1.0 (1.0) In-Reply-To: <54CB4B70.6060900@anderiasch.de> Content-Type: text/plain; charset=gb2312 Content-Transfer-Encoding: quoted-printable Message-ID: Cc: Yasuo Ohgaki , =?GB2312?Q?C=A8=A6sar_Rodas?= , "internals@lists.php.net" X-Mailer: iPhone Mail (12B466) Date: Fri, 30 Jan 2015 09:43:04 +0000 To: Florian Anderiasch Subject: Re: [PHP-DEV] Is it a good idea to have a "strict" mode? From: ajf@ajf.me (Andrea Faulds) Hi, > On 30 Jan 2015, at 09:14, Florian Anderiasch wrote: >=20 >=20 >=20 >> On 01/30/2015 06:36 AM, Yasuo Ohgaki wrote: >> Hi Cesar, >>=20 >>> On Fri, Jan 30, 2015 at 2:16 PM, C=A8=A6sar Rodas wrote= : >>>=20 >>> 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. >>>=20 >>> I think it should be a bit different in PHP, it should encourage the >>> following things: >>>=20 >>> - 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. >>>=20 >>> ```php >>> "use strict"; >>>=20 >>> var_dump(FOOBAR); // should throw an exception, undefined constant. >>> ``` >>=20 >> We have error_reporting INI for this purpose. >> Users may be strict or lazy for errors by the INI setting. >=20 > 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. >=20 > ~Florian >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20 I agree. Use error handlers. -- Andrea Faulds http://ajf.me/=