Re: late static binding php6

From: Date: Mon, 26 Nov 2007 05:43:34 +0000
Subject: Re: late static binding php6
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-33431@lists.php.net to get a copy of this message
Hi, Am Montag, den 19.11.2007, 10:52 +0100 schrieb Hodicska Gergely: [...] > I think the *behavior* of the two code blocks is confusing. And I > *understand* that it can be stated in the manual that it works in this > way, but *maybe* not this is the best solution. Why not something like this to fit both needs (I can think on scenarios for both): class ActiveRecord { public static function find($id) { echo get_called_class() . "\n"; } } class Something extends ActiveRecord { public static function find($id) { return parent::find($id); } } class ActiveRecord2 { sensitive public static function find($id) { echo get_called_class() . "\n"; } } class Something2 extends ActiveRecord { public static function find($id) { return parent::find($id); } } class Another extends Something2 { public static function find($id) { return parent::find($id); } } ActiveRecord::find(1); // "ActiveRecord" Something::find(2); // "ActiveRecord" ActiveRecord2::find(2); // "ActiveRecord2" Something2::find(1); // "Something2" => parent method is sensitive Another::find(1); // "Something2" => parent method is not sensitive cu, Lars -- »Die Glorifizierung der prächtigen underdogs läuft auf die des prächtigen Systems heraus, das sie dazu macht.« -- Theodor W. Adorno, »Minima Moralia«: They, the people Lars Strojny Nießenstr. 36 51003 Cologne Jabber/Mail: lars@strojny.net Weblog: http://usrportage.de

Attachment: [application/pgp-signature] Dies ist ein digital signierter Nachrichtenteil signature.asc
« previous php.internals (#33431) next »