Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:3432 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21235 invoked from network); 15 Jul 2003 23:27:55 -0000 Received: from unknown (HELO morpheus.webteckies.org) (24.132.35.224) by pb1.pair.com with SMTP; 15 Jul 2003 23:27:55 -0000 Received: from ghost.lan.webteckies.org (ghost.lan.webteckies.org [192.168.1.10]) by morpheus.webteckies.org (Postfix) with ESMTP id 19FEA107C6 for ; Wed, 16 Jul 2003 01:27:38 +0200 (CEST) Organization: Php.net To: Php Dev Date: Wed, 16 Jul 2003 01:27:52 +0200 User-Agent: KMail/1.5.2 References: <3F147B5D.5070406@chiaraquartet.net> <476548785.20030716001134@post.rwth-aachen.de> In-Reply-To: <476548785.20030716001134@post.rwth-aachen.de> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Message-ID: <200307160127.52308.msopacua@php.net> Subject: Re: [PHP-DEV] $this assignment and call_user_func question From: msopacua@php.net (Melvyn Sopacua) Hi Marcus, On Wednesday 16 July 2003 00:11, Marcus B=F6rger wrote: > Wednesday, July 16, 2003, 12:08:29 AM, you wrote: > > GB> Hi, > > GB> I've heard rumors that there are plans to take away the ability to > GB> assign to $this in php 5. If this is true, I would like to place a > vote GB> to keep it, as it can be very useful in conjunction with > GB> __call()/__get()/__set() to implement run-time aggregation seamlessly > > Why do you want to trick yourself and the engine? Can't you find a correct > solution? I'm not farmiliar with the example Greg is getting at, but the following bi= t=20 me recently: class DomFromString extends DomDocument { function DomFromString($string) { $this =3D domxml_open_mem($string); } =09 function foo() { echo('foo'); } } $doc =3D new DomFromString($xml); $Root =3D $doc->document_element(); var_dump($doc, $Root); echo($doc->foo()); // call to undefined function I'm farmiliar with the trick-element of this code and why it won't work, bu= t=20 the way to do something similar now, is to *not* extend the extension=20 provided class, use a $this->real_instance and provide methods that re-rout= e=20 the already existing methods to $this->real_instance. Unless there's something I'm missing, I find the latter solution has a much= =20 larger trick element and adds a lot of unnecessary typing. Note that the goal here, is to extend a class of which may not have the sou= rce=20 (or the time/ability to modify it) AND override it's constructor or the=20 constructor is provided by a function, rather than 'new' principle. > Marcus mailto:helly@php.net =2D- Melvyn