Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46792 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68130 invoked from network); 19 Jan 2010 07:14:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jan 2010 07:14:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=indeyets@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=indeyets@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.227 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: indeyets@gmail.com X-Host-Fingerprint: 209.85.218.227 mail-bw0-f227.google.com Received: from [209.85.218.227] ([209.85.218.227:33420] helo=mail-bw0-f227.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C2/0F-22457-2EB555B4 for ; Tue, 19 Jan 2010 02:14:43 -0500 Received: by bwz27 with SMTP id 27so49200bwz.1 for ; Mon, 18 Jan 2010 23:14:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:mime-version :content-type:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to:x-mailer; bh=5iJ7GwQbAwiJidXVfGjYwVJeLxygAnA5zLNuepJTH/s=; b=ozvzjqUcms79/pm0c2jlN48Ykk/oE1X+g5SDh8C7LRahUiyMzeJPzT0WSbPECI0noC INq2v/aSwFONdavJ5oS87UnjlUai0Ra+VQcST/gjF6JJWZ387L+o/inPXt+ouE2NYWZT OPHU1GFNDeiHnqRGbPCFsTsCRP9nojOdWI6Nw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=ODi9q3qLOq7hsQOUq4wOGzXhh2MiPcJiI2SmCenZe+1U8spW/F0PUbMHp1xJ0Zj3jd zYVztLKxc1wg4FZdBAltpX6h4bAFpMpUlUU/it+mjGYLo1rvOXI21uFEL3CliudxJUGu cvftxNoNQ5Z+9zNbHvjgg3AFr5tdJjNc9Qa1E= Received: by 10.204.155.78 with SMTP id r14mr3943052bkw.201.1263885278057; Mon, 18 Jan 2010 23:14:38 -0800 (PST) Received: from ?192.168.1.15? ([93.185.190.227]) by mx.google.com with ESMTPS id 14sm1027327bwz.5.2010.01.18.23.14.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 18 Jan 2010 23:14:37 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1077) Content-Type: text/plain; charset=windows-1252 In-Reply-To: <4B54FC87.8070106@zend.com> Date: Tue, 19 Jan 2010 10:14:34 +0300 Cc: 'PHP Internals' Content-Transfer-Encoding: quoted-printable Message-ID: References: <4B54FC87.8070106@zend.com> To: Stanislav Malyshev X-Mailer: Apple Mail (2.1077) Subject: Re: [PHP-DEV] function call chaining From: indeyets@gmail.com (Alexey Zakhlestin) On 19.01.2010, at 3:27, Stanislav Malyshev wrote: > Hi! >=20 > I wrote a small patch that enables this kind of syntax in PHP: >=20 > foo()(); >=20 > 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. I like it! regarding $foo->bar()()=85 is it possible to use precedence rules here? something like: ($foo->bar())(); > 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? why curly braces? Parentheses would feel more natural here. Would be nice if something like this worked too: (new Class())->method();