Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46448 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68866 invoked from network); 16 Dec 2009 16:16:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Dec 2009 16:16:27 -0000 Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 69.5.8.4 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 69.5.8.4 hc02.futurequest.net Linux 2.4/2.6 Received: from [69.5.8.4] ([69.5.8.4:46769] helo=hc02.futurequest.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8C/7F-13001-AD7092B4 for ; Wed, 16 Dec 2009 11:16:27 -0500 Received: (qmail 4358 invoked from network); 16 Dec 2009 16:16:22 -0000 X-Originating-IP: [66.166.38.114] Message-ID: <4B2907D6.7060108@garfieldtech.com> Date: Wed, 16 Dec 2009 10:16:22 -0600 User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: internals@lists.php.net References: <4B01A4C2.8030602@gmx.net> <4B27DD0B.1070303@gmx.net> <10845a340912160200q72ed4999jc0c956ded788b8ff@mail.gmail.com> In-Reply-To: <10845a340912160200q72ed4999jc0c956ded788b8ff@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Closures and $this From: larry@garfieldtech.com ("larry@garfieldtech.com") Richard Quadling wrote: > How much of a use case is binding $this to closures (personally, I > think this is quite a common usage, but I've been using JavaScript so > maybe I've got the wrong head on). > > But, if there are significant technical/internal issues with regard to > binding $this to closures, what about (and I'm expecting the usual > shoot down here as I obviously know squat) NOT binding closures at all > (option 0). > > Instead get traits working. *snip* If I recall the trait discussion properly, traits are a compile-time thing. Closure binding is a run-time thing. They are not comparable and one cannot really be used to implement the other. (Well, hypothetically bound closures could kinda-sorta replicate traits, but it would be a pretty lousy way of doing it as you get no compile-time enforcement or interface support.) --Larry Garfield