Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46797 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92577 invoked from network); 19 Jan 2010 10:53:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jan 2010 10:53:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.226 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.219.226 mail-ew0-f226.google.com Received: from [209.85.219.226] ([209.85.219.226:48931] helo=mail-ew0-f226.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5C/23-22457-44F855B4 for ; Tue, 19 Jan 2010 05:53:57 -0500 Received: by ewy26 with SMTP id 26so812625ewy.23 for ; Tue, 19 Jan 2010 02:53:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=lLZsCbBjfJtS6B9s3w8HiUsMWT8f0aARDuiiInf1Va8=; b=REyz4kk2NczDqFMnHg7qCxeH2ENA9y+KYXDfngvtVIzPRugD7vt5rUN8ug5grghlLn 8s2mf6u6wiXZOoe772mwfZnDVjCsaJ575nufebJtj0PfT6gQmdrC4nJIm3fr2e5n5Gu+ Aood4bKCkYnZHTlsUOylKdiWrNPG6uDYW1Qdc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=DAvy4XdmITyqXEiYxIvoyRJDXi1cAuuxzeduV6tfOcEjh4tHzo0dbH/Y4PqEP4WjkT WoQ71nyyC3sLoaTezur1iqBedRVclAYCll7uxROC6Vac+BZC28RGiQnYQ8C/argUyddC BKO+AYqN2tMy0aBR/9k0knzBFRxChU4jlKxmE= MIME-Version: 1.0 Received: by 10.216.89.70 with SMTP id b48mr686260wef.160.1263898432065; Tue, 19 Jan 2010 02:53:52 -0800 (PST) In-Reply-To: <4B54FC87.8070106@zend.com> References: <4B54FC87.8070106@zend.com> Date: Tue, 19 Jan 2010 11:53:52 +0100 Message-ID: To: Stanislav Malyshev Cc: PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] function call chaining From: pierre.php@gmail.com (Pierre Joye) hi Stan, On Tue, Jan 19, 2010 at 1:27 AM, Stanislav Malyshev wrote: > Hi! > > I wrote a small patch that enables this kind of syntax in PHP: > > foo()(); > > What it means is that if foo() returns callable value (which probably should > be function name or closure) then it would be called. Parameters and more > than two sets of () work too. > Of course, this is mostly useful for doing closures, and that was primary > drive for implementing it - to make working with closures and especially > function returning closures easier. > What does not work currently is $foo->bar()() - since it is surprisingly > hard to tell parser it's not {$foo->bar}()() - which of course is not what I > want to do. > > The patch is here: http://random-bits-of.info/funcfunc.diff > > What do you think? If somebody has better idea btw - maybe make something > like {foo()}() - and make that work for any expression inside {} - that > might work too. So, what do you think? I'm not a fan of this kind of syntaxic sugars, especially for procedural implementation only. What are the benefits? Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org