Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52071 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37299 invoked from network); 28 Apr 2011 18:49:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Apr 2011 18:49:29 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 207.97.245.133 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 207.97.245.133 smtp133.iad.emailsrvr.com Linux 2.6 Received: from [207.97.245.133] ([207.97.245.133:43099] helo=smtp133.iad.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/51-29189-7B6B9BD4 for ; Thu, 28 Apr 2011 14:49:28 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp33.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id 9AE0030330; Thu, 28 Apr 2011 14:49:25 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp33.relay.iad1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id E46413032F; Thu, 28 Apr 2011 14:49:24 -0400 (EDT) Message-ID: <4DB9B6B3.1090401@sugarcrm.com> Date: Thu, 28 Apr 2011 11:49:23 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: Ferenc Kovacs CC: Felipe Pena , internals References: <4DB923E6.3020307@sugarcrm.com> <4DB9A7BE.6010307@sugarcrm.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Return type-hint From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > it's the same as for the current argument type hinting. > you can access that information via Reflection > http://hu2.php.net/manual/en/reflectionparameter.getclass.php Really? That's how you write your code - do a reflection check before every call? Nobody does that. > why did we added ppp if people can define in the documentation(or in the > method name :/) that which method is public and which isn't Well, this is a good argument, PPP case seems close. Still, PPP is not really as dynamic as variable types are - PPP picture is much simpler and it also serves the call target, not the caller - i.e., the caller does not rely on pretty much anything in PPP, while the target relies on its protected functions not being called by strangers. So my main objection is that return typing doesn't actually serve the caller. Also, the fact that for PHP is extremely common to return null/false from methods on error makes a big hole in this concept even if we accepted the return typing as a counterpart to existing argument typing. E.g., seeing something like: function (Foo|Bar|false|null) ugly() makes me fill dizzy. This doesn't look like something we'd want. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227