Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37237 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71770 invoked from network); 25 Apr 2008 21:22:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Apr 2008 21:22:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=chrisstocktonaz@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=chrisstocktonaz@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.200.173 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: chrisstocktonaz@gmail.com X-Host-Fingerprint: 209.85.200.173 wf-out-1314.google.com Received: from [209.85.200.173] ([209.85.200.173:45986] helo=wf-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DC/F4-18287-68B42184 for ; Fri, 25 Apr 2008 17:22:15 -0400 Received: by wf-out-1314.google.com with SMTP id 27so3069212wfd.26 for ; Fri, 25 Apr 2008 14:22:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=9de5Rlp3lyx8PdRTtX+lCKCFsV+T680tkHMe+oAIQOM=; b=j8xXdy+z8pnysuocEdF1OjMzqzN4eMux7X7NvMXlLlsFSwkuWkxAI9wa3whna167WP6fHhq4EnV/39Uf7ZgJ454jbDZj5t1NYAyDAzy0Ifq2pladiVSjDAsW1Zvnn46rAEAETj1Cj16/V+7sNLwrlSpoJVQtqVO+ii8yFo7AYwM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=SY+bXPwg0UkJyngbcPZJ/Qa5KP9eOhyJM8GpA4wDnTayT7GBZmHClgIwvLelPc0PGLXSwiHlu1o41AiMcm9RmjKszbJc/niweL9MJ1pNqGAP+gv2r2zO4jYbk1fDByp0vCdnFXTN1RAvLgpKkLVinlaGfvObI1B+p0k9YMtfxgU= Received: by 10.142.58.20 with SMTP id g20mr1191909wfa.338.1209158531961; Fri, 25 Apr 2008 14:22:11 -0700 (PDT) Received: by 10.142.178.15 with HTTP; Fri, 25 Apr 2008 14:22:10 -0700 (PDT) Message-ID: Date: Fri, 25 Apr 2008 14:22:10 -0700 To: "Sam Barrow" Cc: "Nathan Nobbe" , "Jeremy Privett" , "Alain Williams" , internals@lists.php.net In-Reply-To: <1209151505.20639.25.camel@sbarrow-desktop> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_7739_22052727.1209158531940" 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> Subject: Re: [PHP-DEV] Return type hinting patch From: chrisstocktonaz@gmail.com ("Chris Stockton") ------=_Part_7739_22052727.1209158531940 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ------=_Part_7739_22052727.1209158531940--