Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75442 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51634 invoked from network); 14 Jul 2014 12:36:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Jul 2014 12:36:01 -0000 Authentication-Results: pb1.pair.com header.from=addw@phcomp.co.uk; sender-id=permerror Authentication-Results: pb1.pair.com smtp.mail=addw@phcomp.co.uk; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain phcomp.co.uk designates 78.32.209.33 as permitted sender) X-PHP-List-Original-Sender: addw@phcomp.co.uk X-Host-Fingerprint: 78.32.209.33 freshmint.phcomp.co.uk Received: from [78.32.209.33] ([78.32.209.33:47943] helo=mint.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B1/21-43645-0BEC3C35 for ; Mon, 14 Jul 2014 08:36:01 -0400 Received: from addw by mint.phcomp.co.uk with local (Exim 4.72) (envelope-from ) id 1X6fU5-00079L-0e for internals@lists.php.net; Mon, 14 Jul 2014 13:35:57 +0100 Date: Mon, 14 Jul 2014 13:35:56 +0100 To: internals@lists.php.net Message-ID: <20140714123556.GH6540@phcomp.co.uk> Mail-Followup-To: internals@lists.php.net References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <53C2178E.7070705@sugarcrm.com> <53C24061.6050503@lsces.co.uk> <20140713101840.GR6540@phcomp.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Parliament Hill Computers Ltd User-Agent: Mutt/1.5.20 (2009-12-10) Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) From: addw@phcomp.co.uk (Alain Williams) On Mon, Jul 14, 2014 at 02:19:15PM +0200, Ferenc Kovacs wrote: > > function foo(int $a) > > { > > var $b; // $b has no type hinting > > var float $c; // $c is a float > > string $d; // alternative to the syntax used for $c (see below) > > } > I think it would be better to reuse declare() instead of reusing var. As a matter of curiosity, why ? The nice thing about 'var' is that it is the syntax used by other languages, eg Javascript. > What error level would it emit though? > I anything below E_RECOVERABLE_ERROR, then it doesn't do anything, but > prints a line to the error log(and or displays it), which we already do, > because using an undefined variable will emit an E_NOTICE > I think it is a good thing if we make it easier to spot programming errors > and bail out early instead of trying to guess the developer's intention, > but I don't think that adding more fatal errors or > E_RECOVERABLE_ERRORs(which will be fatal if there is no userland error > handler defined which explicitly allows to continue the execution). This sort of error should be picked up the first time that the script is compiled, it does not need to be executed (other than conditional includes). This means that these errors will be picked up very quickly. -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include