Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52053 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57164 invoked from network); 28 Apr 2011 10:00:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Apr 2011 10:00:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=addw@phcomp.co.uk; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=addw@phcomp.co.uk; sender-id=permerror Received-SPF: pass (pb1.pair.com: domain phcomp.co.uk designates 80.68.91.63 as permitted sender) X-PHP-List-Original-Sender: addw@phcomp.co.uk X-Host-Fingerprint: 80.68.91.63 bytemark.phcomp.co.uk Received: from [80.68.91.63] ([80.68.91.63:41330] helo=bytemark.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E3/55-28716-CAA39BD4 for ; Thu, 28 Apr 2011 06:00:19 -0400 Received: from freshmint.phcomp.co.uk ([78.32.209.33] helo=mint.phcomp.co.uk) by bytemark.phcomp.co.uk with esmtps (TLSv1:AES256-SHA:256) (Exim 4.71) (envelope-from ) id 1QFO0t-0007Fb-Du; Thu, 28 Apr 2011 10:59:59 +0100 Received: from addw by mint.phcomp.co.uk with local (Exim 4.63) (envelope-from ) id 1QFO0s-0004Qd-Rf; Thu, 28 Apr 2011 10:59:58 +0100 Date: Thu, 28 Apr 2011 10:59:58 +0100 To: Rasmus Lerdorf Cc: Stas Malyshev , Reindl Harald , "internals@lists.php.net" Message-ID: <20110428095958.GM8496@phcomp.co.uk> Mail-Followup-To: Rasmus Lerdorf , Stas Malyshev , Reindl Harald , "internals@lists.php.net" References: <4DB923E6.3020307@sugarcrm.com> <4DB925D4.5090107@thelounge.net> <4DB926B4.5000307@sugarcrm.com> <20110428085859.GJ8496@phcomp.co.uk> <4DB936C8.2080801@lerdorf.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DB936C8.2080801@lerdorf.com> User-Agent: Mutt/1.4.2.2i Organization: Parliament Hill Computers Ltd Subject: Re: [PHP-DEV] [RFC] Return type-hint From: addw@phcomp.co.uk (Alain Williams) On Thu, Apr 28, 2011 at 02:43:36AM -0700, Rasmus Lerdorf wrote: > > function array foo() { .... } > > > > $ret = foo(); > > foreach($ret as $val) > > .... > > I don't see this being useful at all. All you are doing is duplicating a > runtime warning. We can't possibly know at compile-time whether this > return value is an array or not, so there is no compile-time benefit. The check is not done where foo() is called but within foo() itself, to ensure that it only returns an array. There will also be advantages for HipHop which can afford to spend the time to do static analysis of code -- I know that HipHop is not your baby but you now need to recognise that there is more than one PHP implementation and features that may not had much advantage with Zend may be useful elsewhere. -- 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