Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35574 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76717 invoked by uid 1010); 19 Feb 2008 02:26:03 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 76702 invoked from network); 19 Feb 2008 02:26:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Feb 2008 02:26:03 -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 76.96.30.48 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 76.96.30.48 qmta05.emeryville.ca.mail.comcast.net Received: from [76.96.30.48] ([76.96.30.48:59044] helo=QMTA05.emeryville.ca.mail.comcast.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AE/EE-23568-A3E3AB74 for ; Mon, 18 Feb 2008 21:26:02 -0500 Received: from OMTA01.emeryville.ca.mail.comcast.net ([76.96.30.11]) by QMTA05.emeryville.ca.mail.comcast.net with comcast id rDBj1Y07p0EPchoA502S00; Tue, 19 Feb 2008 02:25:26 +0000 Received: from earth.ufp ([24.13.255.226]) by OMTA01.emeryville.ca.mail.comcast.net with comcast id rERx1Y00H4trKQ88M00000; Tue, 19 Feb 2008 02:25:58 +0000 X-Authority-Analysis: v=1.0 c=1 a=Fkn6-fRwDZgjSwWCPjoA:9 a=x1IwlEYcNubGHrmQvZcA:7 a=i6IPZQGjZ4-WADJohEA4uH92mlUA:4 a=FHBbIDN7CdwA:10 a=LY0hPdMaydYA:10 Received: from localhost (localhost [127.0.0.1]) by earth.ufp (Postfix) with ESMTP id A9ABED83FB for ; Mon, 18 Feb 2008 20:25:56 -0600 (CST) Received: from earth.ufp ([127.0.0.1]) by localhost (earth.hsd1.il.comcast.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ooLMDITwEFW2 for ; Mon, 18 Feb 2008 20:25:56 -0600 (CST) Received: from vulcan (unknown [192.168.42.1]) by earth.ufp (Postfix) with ESMTP id 4B18BD83FA for ; Mon, 18 Feb 2008 20:25:46 -0600 (CST) To: internals@lists.php.net Date: Mon, 18 Feb 2008 20:25:44 -0600 User-Agent: KMail/1.9.6 (enterprise 0.20070907.709405) References: <001c01c87264$3c01b4e0$b4051ea0$@de> <200802181936.17739.larry@garfieldtech.com> <47BA34AB.6010408@lerdorf.com> In-Reply-To: <47BA34AB.6010408@lerdorf.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200802182025.44275.larry@garfieldtech.com> Subject: Re: [PHP-DEV] RFC: Traits for PHP From: larry@garfieldtech.com (Larry Garfield) On Monday 18 February 2008, Rasmus Lerdorf wrote: > Larry Garfield wrote: > > You also note that this mechanism has no runtime impact. That's > > unfortunate, because I'd find the ability to add methods to an object at > > runtime conditionally based on some other value far more useful in my > > work. :-) Especially since, as above, there seems to be a way to > > implement this functionality now as-is with a little more typing, yet > > runtime modification is still impossible without eval() and similar scary > > stuff. > > The idea here is that we want to be able to cache opcodes, classes and > functions and optimize them out of the runtime context so the executor > can skip creating classes and functions on every single request. A lot > of the traffic on this list over the past couple of months seems to > ignore this basic premise. Features such as autoload and runtime object > manipulation incur a huge performance hit in the sense that they change > something that was free before and not only add the cost of the feature > itself, but it also means the object in question now can no longer be > cached and has to be created on every single request. > > This doesn't mean we can't consider such features, but people need to > also consider the performance implications. > > -Rasmus Indeed, those are a concern. That's why I thought the closure proposal from late December was so promising, because it appeared (to my non-C-coding eyes) to not have any runtime compilation, just indirect calling. It looks like Traits as described in the original post wouldn't have a runtime cost, but might (depending on the cost of building the code references) have a notable compile cost. Runtime would cost more, but could they be done in a non-terrible way? (I don't know; that's why I'm asking.) Is the lookup table for what functions exist within a class/object easy/fast to manipulate or slow? -- Larry Garfield AIM: LOLG42 larry@garfieldtech.com ICQ: 6817012 "If nature has made any one thing less susceptible than all others of exclusive property, it is the action of the thinking power called an idea, which an individual may exclusively possess as long as he keeps it to himself; but the moment it is divulged, it forces itself into the possession of every one, and the receiver cannot dispossess himself of it." -- Thomas Jefferson