Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52061 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17054 invoked from network); 28 Apr 2011 16:48:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Apr 2011 16:48:57 -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:49002] helo=bytemark.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A7/12-03888-97A99BD4 for ; Thu, 28 Apr 2011 12:48:57 -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 1QFUOW-0002U3-0e; Thu, 28 Apr 2011 17:48:48 +0100 Received: from addw by mint.phcomp.co.uk with local (Exim 4.63) (envelope-from ) id 1QFUOV-0007vh-Bs; Thu, 28 Apr 2011 17:48:47 +0100 Date: Thu, 28 Apr 2011 17:48:47 +0100 To: Ben Schmidt Cc: internals@lists.php.net Message-ID: <20110428164847.GY8496@phcomp.co.uk> Mail-Followup-To: Ben Schmidt , internals@lists.php.net References: <4DB923E6.3020307@sugarcrm.com> <4DB98E8A.409@yahoo.com.au> <20110428161043.GX8496@phcomp.co.uk> <4DB99807.20408@yahoo.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4DB99807.20408@yahoo.com.au> 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 Fri, Apr 29, 2011 at 02:38:31AM +1000, Ben Schmidt wrote: > I also see the value of such type checking for such a use case, obviously. > > I guess there's a reason for it after all. > > I'd still like to see something neat to handle more than just named > classes, though, e.g. scalars, and things like "false on error" for return > values. That is why I suggested, in addition to the above, a syntax like: function (Foo | NULL) foo($something) { to be able to specify where a function can return more than one type. The 'extra' types/values are nearly always either NULL or FALSE. I agree that being able to specify as types: array, scalar, int, string, ... would be useful for a compiler but prob have little value for Zend - other than documentation/reflection. -- 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