Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32543 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1333 invoked by uid 1010); 2 Oct 2007 13:03:06 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 1317 invoked from network); 2 Oct 2007 13:03:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Oct 2007 13:03:06 -0000 Authentication-Results: pb1.pair.com header.from=dz@bitxtender.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=dz@bitxtender.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain bitxtender.com from 80.237.132.12 cause and error) X-PHP-List-Original-Sender: dz@bitxtender.com X-Host-Fingerprint: 80.237.132.12 wp005.webpack.hosteurope.de Received: from [80.237.132.12] ([80.237.132.12:34145] helo=wp005.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 70/00-01175-77142074 for ; Tue, 02 Oct 2007 09:02:49 -0400 Received: from [213.23.52.58] (helo=[192.168.1.21]); authenticated by wp005.webpack.hosteurope.de running ExIM using esmtpsa (TLSv1:RC4-SHA:128) id 1IchOR-0007oy-Dw; Tue, 02 Oct 2007 15:02:31 +0200 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-ID: <952CA761-665E-45E2-963D-088F6306DAEA@bitxtender.com> Cc: PHP Developers Mailing List Content-Transfer-Encoding: 7bit Date: Tue, 2 Oct 2007 15:02:29 +0200 To: Sebastian Bergmann X-Mailer: Apple Mail (2.752.2) X-bounce-key: webpack.hosteurope.de;dz@bitxtender.com;1191330169;f1abc19d; Subject: Re: [PHP-DEV] Class Posing From: dz@bitxtender.com (=?ISO-8859-1?Q?David_Z=FClke?=) would it be possible to overload final classes? - David Am 02.10.2007 um 11:32 schrieb Sebastian Bergmann: > From [1]: > > Objective-C permits a class to wholly replace another class > within a > program. The replacing class is said to "pose as" the target class. > All messages sent to the target class are then instead received by > the posing class. > > There are several restrictions on which classes can pose: > > * A class may only pose as one of its direct or indirect > superclasses. > > [The other restrictions do not apply to PHP] > > Earlier this year, Johannes implemented class posing for PHP as > follows: > > class Foo {} > class Bar extends Foo {} > > function new_overload($className) > { > if ($className == 'Foo') { > return new Bar; > } > > // ... > } > > $o = new Foo; > // $o is an object of Foo. > > register_new_overload('new_overload'); > > $o = new Foo; > // $o is an object of Bar. > ?> > > We (Johannes, Marcus, Sara, and myself) then discussed where to > put this > functionality. Outside of core, there were two places that both make > sense: pecl/operator and pecl/runkit. > > However, to make this a viable mechanism that can be used in tools > such > as PHPUnit (for which I could really use this functionality), we > agreed > that it actually belongs into the core. > > Opinions? Needless to say that I would love to see this in PHP > 5.3 ;-) > > -- > [1] http://en.wikipedia.org/wiki/Objective_C#Posing > > -- > Sebastian Bergmann http://sebastian- > bergmann.de/ > GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 > B85B 5D69 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >