Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32726 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48345 invoked by uid 1010); 10 Oct 2007 16:09:01 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 48330 invoked from network); 10 Oct 2007 16:09:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Oct 2007 16:09:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=ralph@smashlabs.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ralph@smashlabs.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain smashlabs.com from 67.15.58.61 cause and error) X-PHP-List-Original-Sender: ralph@smashlabs.com X-Host-Fingerprint: 67.15.58.61 openrce.org Linux 2.6 Received: from [67.15.58.61] ([67.15.58.61:41862] helo=users.smashlabs.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 69/DE-55062-C19FC074 for ; Wed, 10 Oct 2007 12:09:01 -0400 Received: (qmail 8096 invoked from network); 10 Oct 2007 11:08:58 -0500 Received: from localhost (HELO ?127.0.0.1?) (127.0.0.1) by localhost with (DHE-RSA-AES256-SHA encrypted) SMTP; 10 Oct 2007 11:08:57 -0500 Message-ID: <470CF914.2090201@smashlabs.com> Date: Wed, 10 Oct 2007 09:08:52 -0700 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061207 Thunderbird/1.5.0.9 Mnenhy/0.7.4.666 MIME-Version: 1.0 To: Sebastian CC: internals@lists.php.net References: <2C.E0.51252.D52DB074@pb1.pair.com> In-Reply-To: <2C.E0.51252.D52DB074@pb1.pair.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] new feature -> with() From: ralph@smashlabs.com (Ralph Schindler) > --------------------------- > $class=new class; > > with($class) > { > do_something(); > do_more(); > do(); > } What more value does this hold over implementing fluent interfaces which are already possible? Assuming class Foo { public function doSomething() { /**code**/ return $this; } public function doMore() { /**code**/ return $this; } public function doDo() { /**code**/ return $this; } } You can do this: $bar = new Foo() $bar->doSomething()->doMore()->doDo(); or, if you want exceptional fallthrough: try { $bar->doSomething() ->doMore() ->doDo(); } catch (Exception $e) { ... } -ralph