Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49122 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2705 invoked from network); 23 Jul 2010 04:05:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jul 2010 04:05:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=kalle.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=kalle.php@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: kalle.php@gmail.com X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:50019] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 45/10-00804-BE4194C4 for ; Fri, 23 Jul 2010 00:05:00 -0400 Received: by bwz11 with SMTP id 11so1518850bwz.29 for ; Thu, 22 Jul 2010 21:04:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=/tKFmruxkpvn+C5W7wbDtyQQQeYULZ3+W4vEBV6YG1o=; b=PKVHVUtMBEn1HYjKP8sVwJng+WqIRDRHL2RGPWR5vBfyKCiDvp844F0Rrju3h4eMbB OrVhDAn7i/6vQAZFKRvujlV7/5LznuJbHZTo/v3C3TKPsOlYFauMZh7AuPSZDH3h6UG4 BT9MnCthM79iFYlWqTlWmF8jolgXJ1WUpFB1k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=T3xG7OlUf/HOHHUQVPZ1h6X6EEspR/OXnwDcxuHlQrO5/5tmCYuCiF2JbM/68+l4DG uHjHeMHNGbhN5SvmdnGbpBTl28nwi89TV5TcpmnkHy235b64Uxj0bSReAteBLfiK2kva DaSLzHHxg/S7NFwK4eDzVn2kqKrpP8JadJCFU= MIME-Version: 1.0 Received: by 10.204.7.217 with SMTP id e25mr2268383bke.32.1279857896668; Thu, 22 Jul 2010 21:04:56 -0700 (PDT) Sender: kalle.php@gmail.com Received: by 10.204.18.132 with HTTP; Thu, 22 Jul 2010 21:04:56 -0700 (PDT) In-Reply-To: References: <730E72B7-B2C3-4FF9-8138-F04659ECDB56@php.net> Date: Fri, 23 Jul 2010 06:04:56 +0200 X-Google-Sender-Auth: -zajc3aCh_PNmb5Xd3rN8ChjYrc Message-ID: To: Karoly Negyesi Cc: Joel Perras , Davey Shafik , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Remove variable function and method calls From: kalle@php.net (Kalle Sommer Nielsen) 2010/7/23 Karoly Negyesi : > On Thu, Jul 22, 2010 at 5:42 PM, Joel Perras wrote: >> What's confusing about it? Each expression means something very >> different and distinct. >> >> I use $foo(), new $foo(), classname::$foo, classname::$foo(), >> $bar::$foo, $bar::$foo(), etc. on a regular basis, and it can make for >> some very elegant, concise and readable code. > > So you do not consider it utterly confusing that > > classname::$foo > classname::$foo() > > mean two completely different things? The first reads a property the > second reads a local variable. Any time you need to backtrack when you > the source code because something you tackled on after changes the > meaning of the code completely is considered horribly confusing in my > opinion. > > And then it's utterly nontrivial what > > new $foo() > > *should* do. Should it call $foo() and instantiate the class name > found in the return value or should instantiate the class found in > $foo? > > If you nuke variable function calls and method calls and replace them > with call_user_func() then these go away. > I do not see whats wrong with the variable function call syntax at all, most other languages like JS have similar concepts, even C. But unlike those, PHP does not use function pointers and is loosely typed so there is "no" distinct callback type. Variable function calls are very handy for various tasks that have a really dynamic internal API, removing it from the language is a huge BC break, along with all the other statements in this threads. So no its not going to be removed. -- regards, Kalle Sommer Nielsen kalle@php.net