Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52079 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34365 invoked from network); 29 Apr 2011 05:04:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Apr 2011 05:04:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.193 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.193 smtp193.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.193] ([67.192.241.193:55220] helo=smtp193.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/C0-29189-7D64ABD4 for ; Fri, 29 Apr 2011 01:04:24 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp9.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id BBFB73C0312; Fri, 29 Apr 2011 01:04:20 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp9.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 45F273C02E8; Fri, 29 Apr 2011 01:04:20 -0400 (EDT) Message-ID: <4DBA46D3.4050008@sugarcrm.com> Date: Thu, 28 Apr 2011 22:04:19 -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> <4DB9B6B3.1090401@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! > yeah, but usually you return null/false in case of error when you write > procedural code. Nope. I use it all the time when writing OO code and when "nothing" or "no object" or "can't do this" is a valid answer for a function to return. > but since we wouldn't support the return typehint for scalars, maybe we > could assume that the only sane people who would use this feature would > also do the error handling will through Exceptions (@throws :P). Exceptions are for _exceptional_ situations. If you query a DB for an object and there's no object like this, you don't want an exception if this situation is normal and handled in your code - you want a null or false or something like that. Exception is for situations that you code can not foresee or handle, they are not for regular data flow control. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227