Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78660 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84007 invoked from network); 4 Nov 2014 18:15:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Nov 2014 18:15:10 -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.172 as permitted sender) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.216.172 mail-qc0-f172.google.com Received: from [209.85.216.172] ([209.85.216.172:52437] helo=mail-qc0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0E/7D-06676-BA719545 for ; Tue, 04 Nov 2014 13:15:09 -0500 Received: by mail-qc0-f172.google.com with SMTP id i17so11263889qcy.17 for ; Tue, 04 Nov 2014 10:15:03 -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=4yjRJxS19VFqPYOwCvK+8KC7VUd+CwBlZdkN/tQaHwE=; b=XRAhAJDtoLY4rRAfQ51BEWXvMNG/RPxoE+ndJ3lKrdknN/gaqcP20k1WWQtdTHLJK1 Z8lX3HkBTMLv3LsEyM5oAZUBWYZQCCc0JkEpBAheVtispbHIgBALU42yBMgfn7c3Ykza PBLA9i8aRxBV7Y96SrRZ7B8Vpv6MJemRgbbZwqnn0jIacxRukdeg/AFy69tdpqWIuJxV nskHXLeEYTHWd4igcXazCcGvhv/z2PXHQiX5FsHNCN4Qpo2T+qYlSFXhPZq+HNsn19mC 4JCQdCTSO664/UYL2vJ4MGzIH62e0bvWluEyq307vYrxVcUkex86cP2Ym91Y4fnmQekc DyLA== X-Gm-Message-State: ALoCoQnS405yzyu5J6anXvm45944Z6ak1wb7HS7fsgKhvTETGuxco7Z5yv04UqxF6Kbuf6zHX8p7 X-Received: by 10.224.89.69 with SMTP id d5mr12490073qam.84.1415124903135; Tue, 04 Nov 2014 10:15:03 -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 d32sm979788qge.20.2014.11.04.10.15.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Nov 2014 10:15:02 -0800 (PST) Message-ID: <545917A2.6000206@lerdorf.com> Date: Tue, 04 Nov 2014 10:14:58 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Andrea Faulds , Stas Malyshev CC: 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> In-Reply-To: <859A97F0-7C58-406A-857B-557F8AA657AD@ajf.me> 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 10:08 AM, Andrea Faulds wrote: > >> On 4 Nov 2014, at 17:46, Stas Malyshev wrote: >> >> Hi! >> >>>> "public Foo function bar()" would be so much worse than "public function >>>> bar() : Foo" >>> >>> Because when you grep for "function bar", in future you'd have to know >>> the return type too. >> >> Sorry, I do not understand - why to grep for "function bar" you'd have >> to know the type? Just grep for "function bar" as you did before. > > Because if that function has a return type, e.g.: > > public function Foo bar() > > Then you couldn’t grep for “function bar” because of the Foo. > > 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. -Rasmus