Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46838 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53733 invoked from network); 20 Jan 2010 12:36:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jan 2010 12:36:38 -0000 Authentication-Results: pb1.pair.com header.from=grobmeier@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=grobmeier@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.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: grobmeier@gmail.com X-Host-Fingerprint: 209.85.220.227 mail-fx0-f227.google.com Received: from [209.85.220.227] ([209.85.220.227:46117] helo=mail-fx0-f227.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B6/4A-29385-5D8F65B4 for ; Wed, 20 Jan 2010 07:36:38 -0500 Received: by fxm27 with SMTP id 27so4545507fxm.23 for ; Wed, 20 Jan 2010 04:36:35 -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 :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=ag9D/Nyo65ki6Y0a0ISr97vmdRRNfb0SP0RQ31a8bUY=; b=eUM4A3XEiK040vT3y/AISkDAFjFJMTFdxa9RYl5MFRKibifdX0Ggksi2oglTNbIWZ6 XJfkwH0C+tLyga/oBagzbcx0vAkmivTvpQ9U4YCSYHOIdBNnUThagQ6W2wwWGPCvboo3 BIB6mCQ7r42/neDAo6Wg/BTdE5cklxdH56tAw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=BuRQ83O6dYlopxEjtlmXPCDiEriBdE28NLX9Pw51zOF0C9h2vxQfZ63EyOKTpe/j3E qFGtj6U89rXx5c8yPUOPCd8X2IYtVlrMi+6pZ50CcS2wX0UajUpC4HqKYBj7JtGI212M DyMYFKcmTZ/exCSwy9SLSuzvgp5dizJDoBXeQ= MIME-Version: 1.0 Received: by 10.102.217.14 with SMTP id p14mr4361815mug.116.1263990994855; Wed, 20 Jan 2010 04:36:34 -0800 (PST) In-Reply-To: <20100120121804.GQ3978@phcomp.co.uk> References: <4B54FC87.8070106@zend.com> <4F.56.22457.408955B4@pb1.pair.com> <4B55D850.8000604@zend.com> <68de37341001190820p486b7c31o5689ab5554b8d260@mail.gmail.com> <4B55E591.8060708@lerdorf.com> <20100120121804.GQ3978@phcomp.co.uk> Date: Wed, 20 Jan 2010 13:36:14 +0100 Message-ID: To: Christian Grobmeier , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: function call chaining From: grobmeier@gmail.com (Christian Grobmeier) >> =C2=A0I also think that: >> =C2=A0 =C2=A0 =C2=A0$foo =3D (new bar())->someSetter(); > > someSetter() could return $this, although unlikely. The result of the lin= e > above would be that the bar object is garbage collected after being creat= ed > & method someSetter() invoked. To keep it one would have to do: In very rare occassions I don't need to keep the object and I am fine with garbage collection. From garbage collection in PHP I know less, but isnt it so that: function blub() { $foo =3D new O(); // do long other stuff } gc's $foo only after the method is finished? function blub() { new O()->doSomething(); } would enable to collect this object before method ends. I am not sure if that works with php, but it might. > this could be simplified to: > > =C2=A0 =C2=A0$employees->findEmployee('John Smith')->increaseSalary(1000)= ; > > This is the sort of reason why chaining is useful. It is also, IMHO, quit= e readable. That is exactly what I would love to see in PHP. Notation is also very similar to java notation. Cheers Christian