Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77782 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83790 invoked from network); 4 Oct 2014 20:14:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Oct 2014 20:14:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.181 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.181 mail-wi0-f181.google.com Received: from [209.85.212.181] ([209.85.212.181:58574] helo=mail-wi0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 42/3A-11734-32550345 for ; Sat, 04 Oct 2014 16:14:27 -0400 Received: by mail-wi0-f181.google.com with SMTP id hi2so1543578wib.2 for ; Sat, 04 Oct 2014 13:14:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=PeaBRvJa1S2ZrIKEAZq0Xwd8mvSVh5QGH+DjA1euZ08=; b=XfJCYOU4H4g6mjawGYSZfNiiqLET2fuTe7gabWCmkD/iAmoMMKZk9G/WAtsWjvItOa xu8cc9lXmSzmkvcuQYN9QPzZ7IOyhIkQxk/c4Z8NbedNr6k9vhhv2CSY/xkMlbr7/31u FZ30yCUjRhyDWziIrfDM3dYmIkpDm7Ug/1+eAUszBqiO+HbY0E9ckrpOtBDJEbCFC7XB DpcmY2MjnMSf5Lr6xjpqzjh3I6v23D1t6FL6lUoxA0XfGYC1EWSZJDibo0MrNjT/w1Pw EB95+1TGM8k7HhpalZbtFfbcIUKlu9zYEJqpmO6D1a/QW0VlVY5RFuNvAMRqADrvEn4t Udbw== X-Received: by 10.194.77.243 with SMTP id v19mr17275246wjw.18.1412453664580; Sat, 04 Oct 2014 13:14:24 -0700 (PDT) Received: from [192.168.0.2] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by mx.google.com with ESMTPSA id gh6sm5927224wib.16.2014.10.04.13.14.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 04 Oct 2014 13:14:23 -0700 (PDT) Message-ID: <5430551D.7030808@gmail.com> Date: Sat, 04 Oct 2014 21:14:21 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: internals@lists.php.net References: <42.58.10205.32DCE245@pb1.pair.com> <9B6F1F10-7B1D-4FB0-A485-4F1C6202701C@googlemail.com> In-Reply-To: <9B6F1F10-7B1D-4FB0-A485-4F1C6202701C@googlemail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PHP7] Remove the function keyword from class methods? From: rowan.collins@gmail.com (Rowan Collins) On 03/10/2014 18:57, Ingwie Phoenix wrote: > C++ does not use a function keyword by itself, and even lesser visibility keywords as PHP does. There have been a couple of comparisons to other languages brought up, but I find them unconvincing. Most languages have some keyword for introducing methods: "def" in Ruby; "sub" in Perl (or "method" when using some of the OO helper extensions such as MooseX::Declare); "defun" in Common Lisp; "procedure" (or "function") in Pascal; etc In C-based languages including C++ and Java, the return type of a function is a compulsory part of the function definition, so a definition never begins simply "foo() { ... }". This gives the code structure a very different feel to loosely typed languages. ECMAScript 6 is an interesting exception which someone mentioned. But then, ECMAScript 6 is quite a strange language, really - it grafts a "class" concept onto a prototype-based type system, and includes a whole set of different sub-routine declarations to overcome limitations in earlier versions of the language, as summarised here: http://www.2ality.com/2013/08/es6-callables.html Now, obviously, PHP doesn't have to follow like a sheep wherever other languages go, but if I read a line in the change log for PHP 7 of "function keyword is now optional for methods", my reaction would be a bemused "why?", followed by a mental note to require it in any coding standards I have influence over. -- Rowan Collins [IMSoP]