Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57039 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88683 invoked from network); 22 Dec 2011 23:21:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Dec 2011 23:21:21 -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 Linux 2.6 Received: from [78.32.209.33] ([78.32.209.33:64033] helo=mint.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A2/26-12618-17BB3FE4 for ; Thu, 22 Dec 2011 18:21:21 -0500 Received: from addw by mint.phcomp.co.uk with local (Exim 4.63) (envelope-from ) id 1Rdrws-00053w-F9 for internals@lists.php.net; Thu, 22 Dec 2011 23:21:18 +0000 Date: Thu, 22 Dec 2011 23:21:18 +0000 To: PHP Developers Mailing List Message-ID: <20111222232118.GL25857@phcomp.co.uk> Mail-Followup-To: PHP Developers Mailing List References: <2095305E-D4E3-4D7E-8218-32EE99688E0C@GMAIL.COM> <2C90FB94-38C4-4270-8C6A-B89304BA8ED8@gmail.com> <159A7CA2-8561-40DA-9434-CAAE12304DDB@gmail.com> <4EF3B56A.4040809@gmail.com> <-2451498990672032588@unknownmsgid> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <-2451498990672032588@unknownmsgid> User-Agent: Mutt/1.4.2.2i Organization: Parliament Hill Computers Ltd Subject: Re: [PHP-DEV] Return Type Hinting for Methods RFC From: addw@phcomp.co.uk (Alain Williams) On Thu, Dec 22, 2011 at 06:08:26PM -0500, Will Fitch wrote: > Most modern languages allow returning null in any case. This is a hail > Mary in the event something happens, but throwing an exception is > inappropriate. I see no reason to diverge from that. Agreed, it is often convenient to return NULL or FALSE to indicate failure or something like end of input (think: fgetc()). I was mulling syntax like: function (string|boolean:false) fgetc(resource $handle) Then the compiler would know that after: if( ($ch = fgetc($in)) === FALSE) return; that $ch is string ... but seems too complicated. -- 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