Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46808 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71188 invoked from network); 19 Jan 2010 16:20:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jan 2010 16:20:07 -0000 Authentication-Results: pb1.pair.com header.from=oorza2k5@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=oorza2k5@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.221 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: oorza2k5@gmail.com X-Host-Fingerprint: 209.85.219.221 mail-ew0-f221.google.com Received: from [209.85.219.221] ([209.85.219.221:42586] helo=mail-ew0-f221.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 43/18-29385-5BBD55B4 for ; Tue, 19 Jan 2010 11:20:06 -0500 Received: by ewy21 with SMTP id 21so1685565ewy.2 for ; Tue, 19 Jan 2010 08:20:02 -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=EjAabXeW2wvkOurYo0eFf3tg6Dqp7NvEi/b2wGeisCs=; b=xPp0E3h/KlJiev9D+mrp3ya4HJy0rm9GCQQCapCYP5Wmq14jYtt9GOxHDyn2N1SpVd 702kjCYfoYXJcSfMX2s5EgUlYRiXMjgGAupfYdMTXX5JCnJi/RNRbF+nZoc4bbz9ejdw LZh7NL2cAX14DdCvrQB0Tt4dYozx7dJLovMUk= 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=lU6WJWqp1TjCv0kr2qBsCozuJjD1k6yuDEnWtJ2zuCLegyTOqnSGe55Ek0kqECvk2L zAkGOVzzKYfUdFxM22S6M9GTIRWynXAOObt0hboOCKEhkhf6KTUhXDxGB9+Uorqmauir C/aknRSmZWsZ4y9oJwYUVEwfowM88OxXoFoBM= MIME-Version: 1.0 Received: by 10.213.102.72 with SMTP id f8mr8307848ebo.26.1263918002407; Tue, 19 Jan 2010 08:20:02 -0800 (PST) In-Reply-To: <4B55D850.8000604@zend.com> References: <4B54FC87.8070106@zend.com> <4F.56.22457.408955B4@pb1.pair.com> <4B55D850.8000604@zend.com> Date: Tue, 19 Jan 2010 11:20:02 -0500 Message-ID: <68de37341001190820p486b7c31o5689ab5554b8d260@mail.gmail.com> To: Stanislav Malyshev Cc: Michael Wallner , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Re: function call chaining From: oorza2k5@gmail.com (Eddie Drapkin) On Tue, Jan 19, 2010 at 11:05 AM, Stanislav Malyshev wrote: > The second was next on my list, while the first seems to me kind of exotic - > why create object only to call one method and immediately drop it? Why this > method is not static then? Why would this imply "dropping" the object? This: $foo = (new bar())->someSetter(); Looks a lot better than this $foo = new bar(); $foo->someSetter(); It's more obvious when you have to store your objects somewhere: $foo->bar[$somevar] = (new bar())->someSetter(); Any object that returns $this a lot makes for a valid use case and right now, we're forced to use a factory method hack, which doesn't always work, especially in the cases where you have a dynamically named class (and you can depend on inheritence to guarantee your method, but not the existence of a static factory method). What arguments are there against this? Why shouldn't it be allowed?