Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78693 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54309 invoked from network); 5 Nov 2014 00:55:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Nov 2014 00:55:15 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=fail Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=fail; sender-id=fail Received-SPF: fail (pb1.pair.com: domain lerdorf.com does not designate 209.85.216.44 as permitted sender) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.216.44 mail-qa0-f44.google.com Received: from [209.85.216.44] ([209.85.216.44:64374] helo=mail-qa0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C1/00-54119-17579545 for ; Tue, 04 Nov 2014 19:55:15 -0500 Received: by mail-qa0-f44.google.com with SMTP id w8so10820303qac.31 for ; Tue, 04 Nov 2014 16:55:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=1VKuxOfqhKLTV5do91cM1mZlLZTYmsc7SBkGMaEHiGc=; b=PTtlA6zRv3nXrWvp8wptX9YsGEIKR9AT4SlCvMCZho+iKIVKAcErNimUfn85IxjWcX 28AGsTtLy9tZ/TaVYqheO/USRbPtfyUefrpNkrHTgERctOlbi6foC6zjvYAkswS9D2mN 0x/zWIAk8Uxl7q/9vbru/eztnVBFUJO6L9NJLwoNfDdFGFH8oGUTyaAlkj9RFrrLN5gd 7Z3kmLfOeZbI8oewYdPSBgQ18/WoH4KmTS+1hkbN3+vHrCeOXttqpFCJ5LpOlKjx8ZNN cpH+DW58wMdT6hN5vTwdr+tfe4unPh09NOZQdoI1U5+1rDXLsnnfUJCISt3vkBPJWMkF sHIQ== X-Gm-Message-State: ALoCoQnnQ3/C/2ltnY80vdtEDizjV651Ttt7NOOyylyG2a+bt0HsVhGqb0arBfjBhVVzzZWXJ5FV X-Received: by 10.140.39.139 with SMTP id v11mr11860980qgv.45.1415148911311; Tue, 04 Nov 2014 16:55:11 -0800 (PST) Received: from [192.168.200.14] (c-50-131-44-225.hsd1.ca.comcast.net. [50.131.44.225]) by mx.google.com with ESMTPSA id u46sm1853437qgd.3.2014.11.04.16.55.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Nov 2014 16:55:10 -0800 (PST) Message-ID: <5459756C.5010806@lerdorf.com> Date: Tue, 04 Nov 2014 16:55:08 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Levi Morrison CC: Andrea Faulds , Stas Malyshev , Leigh , Robert Stoll , PHP Internals References: <002601cff777$eb923430$c2b69c90$@tutteli.ch> <000601cff80a$972e0250$c58a06f0$@tutteli.ch> <5458937F.9020304@sugarcrm.com> <545910F1.8030904@sugarcrm.com> <859A97F0-7C58-406A-857B-557F8AA657AD@ajf.me> <545917A2.6000206@lerdorf.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Types on the right or on the left From: rasmus@lerdorf.com (Rasmus Lerdorf) On 11/04/2014 04:42 PM, Levi Morrison wrote: >>> If we used this syntax instead, which wouldn’t disrupt grep: >>> >>> public Foo function bar(); >>> >>> It’d be inconsistent with normal function declarations which would have to have Foo after function. >> >> I don't understand that inconsistency. >> >> public Foo function bar() { } >> >> looks perfectly sane to me. PHP's syntax was very heavily influenced by >> C from day 1. In C you have: >> >> static int bar() { } >> >> In PHP the 'function' keyword indicates what follows is a function. >> Putting something in between the function keyword and the name of the >> function would confuse me. To me "function bar()" is inseparable and is >> equivalent to "bar()" in C which makes the above examples consistent >> with each other. > > Except `static function()` and `static function foo()` already have > meaning, and if we allowed static return types (very possible) that > would be ambiguous. This syntax is a no-go. static isn't a type it is a scope. You want to expand return types to also cover scopes? How is that in any way useful? -Rasmus