Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52049 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47769 invoked from network); 28 Apr 2011 08:52:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Apr 2011 08:52:38 -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.42 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.42 mail-ew0-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:55483] helo=mail-ew0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BC/C3-28716-5DA29BD4 for ; Thu, 28 Apr 2011 04:52:38 -0400 Received: by ewy2 with SMTP id 2so779583ewy.29 for ; Thu, 28 Apr 2011 01:52:34 -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=IgcMHps4F2FitH3GtauuZGAKGPGbUrTxGSPmhJvTTyg=; b=d0CU+gjnR4axPZJ3jeUCBzzJhgTmioQRzOhCq5NEHhhuJwChenkIOoK95g2stzAOQF w0D1kVI4PEYPWinT6YpdW0AQ3QFg26/E1gWht/872teP6fBvyYoy2zTXndv4r09r1kxW prmKwQWrZz5eUkQzP5WHpnpIX++fEScB/ooj8= 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=fxtu0WW4DF8BahCKYslECh1/R1abPawz1CX6PQiiwbZJWVuZj8xWuq9OZ76z2Hh3Im H7+5JnfCTH55IEJ/u2v5kF+U1ftChJHIFKERXT/Yru5uMGtX55Mcf1ubiXMzirBVYCkb 7YIv1OliBdiGg0SLZTIS2CvWkArItp5F0rjZ8= MIME-Version: 1.0 Received: by 10.14.137.198 with SMTP id y46mr1503979eei.103.1303980754626; Thu, 28 Apr 2011 01:52:34 -0700 (PDT) Sender: tyra3l@gmail.com Received: by 10.14.127.79 with HTTP; Thu, 28 Apr 2011 01:52:34 -0700 (PDT) In-Reply-To: <4DB923E6.3020307@sugarcrm.com> References: <4DB923E6.3020307@sugarcrm.com> Date: Thu, 28 Apr 2011 10:52:34 +0200 X-Google-Sender-Auth: ldGhCUsKrfMY9lplj9A8XsePrLg Message-ID: To: Stas Malyshev Cc: Felipe Pena , internals Content-Type: multipart/alternative; boundary=20cf30363ac3ac692304a1f6ade1 Subject: Re: [PHP-DEV] [RFC] Return type-hint From: info@tyrael.hu (Ferenc Kovacs) --20cf30363ac3ac692304a1f6ade1 Content-Type: text/plain; charset=UTF-8 > > > > The RFC doesn't explain it either beyond "here how you can have some nice > errors". > But why would I want to see these errors? How they would make anything > easier or better? > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 > maybe we should improve on the rfc. I see many advantages of the introduction of return type hinting. - you can guarantee that your methods returns only what is explicitly stated (or else it blows up, the same as for arguments) - it can save you from having to define the return type in phpdoc, your code can define it's behavior - I think maybe the language itself could use that information, for performance, etc. improvements (we know that the return value will be created runtime, but we can throw it away if it doesn't match the return type or something), maybe we can use that information to throw errors on compile time if we find a non runtime decided return value which doesn't match with the return type. I'm sure that others have and will come up with more use cases. Tyrael --20cf30363ac3ac692304a1f6ade1--