Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52081 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58646 invoked from network); 29 Apr 2011 07:37:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Apr 2011 07:37:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.215.170 mail-ey0-f170.google.com Received: from [209.85.215.170] ([209.85.215.170:65341] helo=mail-ey0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 75/94-29189-3DA6ABD4 for ; Fri, 29 Apr 2011 03:37:55 -0400 Received: by eyf5 with SMTP id 5so1091419eyf.29 for ; Fri, 29 Apr 2011 00:37:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=ya38GUSYqHdknupOGNCEhwa3VIy3xmYaKXSYN/h/CZc=; b=V/bBN2yCQGxPY9eoROtxlL0ZkvN7WwQXPqFNvvU8T5/ixpgsC4IpE7WYvsFM9gfHc+ GjMrClFPYEPcY6ifZ+/39YvjHK/NLxy0QCsdTHlWdSNimWax259EhyfyEErPiehKOBjj UnMHs9gNQQjy/4X8qxq+FQ+Oo6kKeCVgYmdrM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=Humqw+6uA97cmjV5YjAQNJOSTkncMJZaum3KDceEf8QcHaSGWEinQ4/VoHtF71UR7f XE/E7U6j1lB1W9gsKsNDk5fFBixxfdRp0oR1jV3bDGpJ95H0Ka3F49HDBpbDmlO0Slys zIwzLrkRb6RyREM5GKrmE5T3zSFMZ3AxFjFcc= MIME-Version: 1.0 Received: by 10.14.137.198 with SMTP id y46mr2123809eei.103.1304062671616; Fri, 29 Apr 2011 00:37:51 -0700 (PDT) Sender: tyra3l@gmail.com Received: by 10.14.127.79 with HTTP; Fri, 29 Apr 2011 00:37:51 -0700 (PDT) In-Reply-To: <4DBA46D3.4050008@sugarcrm.com> References: <4DB923E6.3020307@sugarcrm.com> <4DB9A7BE.6010307@sugarcrm.com> <4DB9B6B3.1090401@sugarcrm.com> <4DBA46D3.4050008@sugarcrm.com> Date: Fri, 29 Apr 2011 09:37:51 +0200 X-Google-Sender-Auth: tFjv6EUFApaqdZRmBGmQZPfvW5Q Message-ID: To: Stas Malyshev Cc: Felipe Pena , internals Content-Type: multipart/alternative; boundary=20cf30363ac34e7b4d04a209c09e Subject: Re: [PHP-DEV] [RFC] Return type-hint From: info@tyrael.hu (Ferenc Kovacs) --20cf30363ac34e7b4d04a209c09e Content-Type: text/plain; charset=UTF-8 On Fri, Apr 29, 2011 at 7:04 AM, Stas Malyshev wrote: > 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. > > some agree, some disagree with that. http://barelyenough.org/blog/2007/11/when-to-use-exceptions/ Tyrael --20cf30363ac34e7b4d04a209c09e--