Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37223 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40809 invoked from network); 25 Apr 2008 17:07:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Apr 2008 17:07:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:27848] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 60/D7-18287-8EF02184 for ; Fri, 25 Apr 2008 13:07:55 -0400 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 25 Apr 2008 20:08:38 +0300 Received: from [192.168.16.217] ([192.168.16.217]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 25 Apr 2008 10:07:09 -0700 Message-ID: <48120F8A.30504@zend.com> Date: Fri, 25 Apr 2008 10:06:18 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Sam Barrow CC: internals@lists.php.net References: <1209137410.6642.9.camel@sbarrow-desktop> In-Reply-To: <1209137410.6642.9.camel@sbarrow-desktop> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 25 Apr 2008 17:07:09.0409 (UTC) FILETIME=[CBF58510:01C8A6F6] Subject: Re: [PHP-DEV] Return type hinting patch From: stas@zend.com (Stanislav Malyshev) Hi! In general, it'd be very nice to have some definition of the proposed feature beyond the patch. It would probably answer some of my questions that follow :) > parameters and return values. Objects with __toString methods are > allowed to pass for scalar and string type hints. What about objects that can be converted to other types (cast_object handler)? > function myTypedFunction returns int(string $stuff, bool, $things, num > $amount) { > return 'This will cause an error.' > } What about return "1"? Also I notice it introduces new keyword - returns. Is it necessary? Each new keyword means broken code. > Parameters and return values are strict. Int means int (to the type), Meaning that int would reject 1.0, true and "1"? bool would reject 1 and 0 and null? Ouch, ouch, ouch. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com