Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37239 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77894 invoked from network); 25 Apr 2008 22:04:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Apr 2008 22:04:28 -0000 Authentication-Results: pb1.pair.com smtp.mail=sam@sambarrow.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sam@sambarrow.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sambarrow.com from 208.70.128.57 cause and error) X-PHP-List-Original-Sender: sam@sambarrow.com X-Host-Fingerprint: 208.70.128.57 smtp-gw31.mailanyone.net Received: from [208.70.128.57] ([208.70.128.57:36419] helo=smtp-gw31.mailanyone.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 62/06-18287-B6552184 for ; Fri, 25 Apr 2008 18:04:28 -0400 Received: from mailanyone.net by smtp-gw31.mailanyone.net with esmtpsa (TLSv1:AES256-SHA:256) (MailAnyone extSMTP sam@sambarrow.com) id 1JpW1m-0001Nm-MM; Fri, 25 Apr 2008 17:04:24 -0500 To: Chris Stockton Cc: Nathan Nobbe , Jeremy Privett , Alain Williams , internals@lists.php.net In-Reply-To: References: <1209137410.6642.9.camel@sbarrow-desktop> <1209147362.20639.7.camel@sbarrow-desktop> <20080425182341.GB14490@mint.phcomp.co.uk> <1209149047.20639.18.camel@sbarrow-desktop> <48122C14.7070705@omegavortex.net> <1209150944.20639.24.camel@sbarrow-desktop> <7dd2dc0b0804251224s750679acn169637efbd8653fa@mail.gmail.com> <1209151505.20639.25.camel@sbarrow-desktop> Content-Type: text/plain Date: Fri, 25 Apr 2008 18:04:22 -0400 Message-ID: <1209161062.31032.1.camel@desktop> Mime-Version: 1.0 X-Mailer: Evolution 2.12.1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Return type hinting patch From: sam@sambarrow.com (Sam Barrow) I don't know, maybe it does work. But either way I'm not introducing a new keyword, I changed the patch to reuse the return keyword. Yes, long strings of keywords: abstract protected string function dostuff() On Fri, 2008-04-25 at 14:22 -0700, Chris Stockton wrote: > On Fri, Apr 25, 2008 at 12:25 PM, Sam Barrow > wrote: > > On Fri, 2008-04-25 at 13:24 -0600, Nathan Nobbe wrote: > > On Fri, Apr 25, 2008 at 1:15 PM, Sam Barrow > wrote: > > On Fri, 2008-04-25 at 14:08 -0500, Jeremy Privett > wrote: > > > Sam Barrow wrote: > > > > I figured it out, the syntax is now as follows: > > > > > > > > function a($b, $c) returns d { > > > > } > > > > > > > > I'll post an update soon. > > > > > > > > > > > > > > > > > > That's certainly a non-intuitive syntax. How about > we take a > > page out of > > > the book of other C-style languages before trying > to invent > > something > > > else? I agree with Stas, "return" and "returns" > are not part > > of a > > > function definition. > > > > > > I don't think it's non-intuitive at all, and even > so, it's the > > most intuitive we have. This ordering makes more > sense to me > > at first glance (in the order I would think about > things; > > scope, name, arguments, return). > > > > im not sure the following has been explicitly proposed, but > how about > > omitting the 'return' keyword and placing the return type > hint before > > the function identifier > > > > function int a($b, $c) {} > > > > > This is, but I don't think this is possible, due to confusion > with the > keywords (public, private, static, abstract, etc). Plus this > leads to > long strings of keywords. > > There can be no technical reason why this more adopted and understood > syntax should not be possible. Adding returns as a keyword would > completely break tons of code. Why are the proposals on something that > is so consistent across many languages being changed so obscurely? Why > a seperate non-intuitive syntax. > > public function int (string $foo) { return 1; } > > Can't we keep the sanity? > > > [ ... ] Plus this leads to > long strings of keywords. > > Are you kidding? strlen('returns int') > strlen('int'); ..... > > > -Chris