Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45973 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82414 invoked from network); 8 Nov 2009 07:44:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Nov 2009 07:44:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=rquadling@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rquadling@googlemail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.220.227 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@googlemail.com X-Host-Fingerprint: 209.85.220.227 mail-fx0-f227.google.com Received: from [209.85.220.227] ([209.85.220.227:46791] helo=mail-fx0-f227.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A6/0B-03668-FE676FA4 for ; Sun, 08 Nov 2009 02:44:48 -0500 Received: by fxm27 with SMTP id 27so691175fxm.23 for ; Sat, 07 Nov 2009 23:44:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=A3pSK7fdW51TrgdJsxvQjXx17sHEwF+uEECWT53N1HA=; b=FyVDjmI+qG8mCE13JSo3Sn1L5FFuPysjpCbe3yq8dsMW8KDo9NZHj4/9G65DspS71T 1UHKvK4vCTKN2EHNb42BnWHd9/fyjiw75TEjRKUCNJB+Sl/4cc/5g+WliGVtRkXOe/jr DI3bdRnlwUSZ2w/A56O0beCniq6IrceNg4cGA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; b=tJZp+/LUdqfCh47hCS69fAmr0QurQ9mr+G2GkAs/JYYrGYQUK6wPjLRMi38n36aRGJ Ls59ijUM4wfWrmJ0IO0VdoVFtTlxiMm9p+BrsrYszCEV452DA/1rHAjf1XYFpysrba3T FsyhiNQIDCS9r+gLdisvOZccvHfEiUkSLhY5Q= MIME-Version: 1.0 Received: by 10.223.6.137 with SMTP id 9mr923936faz.60.1257666284070; Sat, 07 Nov 2009 23:44:44 -0800 (PST) Reply-To: RQuadling@googlemail.com In-Reply-To: <0F.F6.03668.AD206FA4@pb1.pair.com> References: <0F.F6.03668.AD206FA4@pb1.pair.com> Date: Sun, 8 Nov 2009 07:44:24 +0000 Message-ID: <10845a340911072344h1187694xf1714dd8b97ac58e@mail.gmail.com> To: melfar Cc: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Regarding constructions like func()[0] From: rquadling@googlemail.com (Richard Quadling) 2009/11/7 melfar : > Hey, > > Yep, I think there might be some caveats to that change. > The original patch did not work on methods, so I've fixed that and also > made the return value an rvalue, so that you can't attempt to modify the > temporary value, the zend_check_writable_variable guard will yield an error. > > The updated patch can be found at http://bugs.php.net/bug.php?id=50003 > > I've also heard an opinion that adding this construction is just going to > make things more > complicated, but take this: chained -> operators are supported for return > values and I'm only seeing code getting simpler because of that. > > Br, > -melfar > > "mm w" <0xcafefeed@gmail.com> wrote: > >> Hi Melfar, from my point of view I am totally to make this a legal >> call like in python or ruby java, >> as I liked compact code I liked to avoid temp vars especially on a >> read-only call, but it might require some effort there and the final >> patch might be not so simple, anyway this is a community call, what I >> can say about this kind of missing feature "sometimes, I can hear in >> my office" : "PHP is a retarded language, PHP sucks or worst", my >> point there, that is sometimes good to listen to people who are not >> "passionate" by the language but just using it to do their job and be >> paid. >> >> Cheers! >> >> On Sat, Nov 7, 2009 at 3:42 AM, melfar wrote: >>> Hello! >>> >>> I have filed a bug (suggestion) at http://bugs.php.net/bug.php?id=50003 >>> What do you think about enabling such a constructions in future versions >>> of >>> php? >>> >>> Br, >>> -melfar >>> >>> >>> >>> -- >>> PHP Internals - PHP Runtime Development Mailing List >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > Whilst you are all thinking about this, how about ... $value = (function(){return $x;})(); Being able to call an anonymous function inline would certainly be a useful mechanism. Allowing calls without creating dummy user land vars would be consistent with func()[0]. -- ----- Richard Quadling "Standing on the shoulders of some very clever giants!" EE : http://www.experts-exchange.com/M_248814.html Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling