atom feed28 messages in net.php.lists.internals[PHP-DEV] LSB forward_static_call()
FromSent OnAttachments
Etienne KneussJun 20, 2008 9:03 am 
Alexey ZakhlestinJun 20, 2008 9:39 am 
Stanislav MalyshevJun 20, 2008 5:50 pm 
Alexey ZakhlestinJun 20, 2008 10:53 pm 
Etienne KneussJun 21, 2008 1:57 am 
Mike LivelyJun 21, 2008 7:48 am 
Mike LivelyJun 21, 2008 8:31 am 
Lars StrojnyJun 22, 2008 1:02 pm 
Derick RethansJun 22, 2008 1:10 pm 
Jochem MaasJun 22, 2008 3:44 pm 
Etienne KneussJun 22, 2008 5:05 pm 
Jochem MaasJun 23, 2008 2:15 am 
Mike LivelyJun 23, 2008 6:35 am 
Stanislav MalyshevJun 23, 2008 9:56 am 
Stanislav MalyshevJun 23, 2008 10:22 am 
Etienne KneussJun 23, 2008 11:46 am 
Lars StrojnyJun 23, 2008 1:21 pm 
Larry GarfieldJun 23, 2008 8:43 pm 
Alexey ZakhlestinJun 23, 2008 10:07 pm 
Stanislav MalyshevJun 24, 2008 9:37 am 
Janusz LewandowskiJun 24, 2008 9:52 am 
Stanislav MalyshevJun 24, 2008 9:59 am 
Janusz LewandowskiJun 24, 2008 10:14 am 
Stanislav MalyshevJun 24, 2008 10:32 am 
Etienne KneussJun 24, 2008 11:04 am 
Stanislav MalyshevJun 24, 2008 11:08 am 
Etienne KneussJun 24, 2008 12:23 pm 
Ryan PanningJun 24, 2008 12:56 pm 
Subject:[PHP-DEV] LSB forward_static_call()
From:Etienne Kneuss (col@php.net)
Date:Jun 20, 2008 9:03:50 am
List:net.php.lists.internals

Hi,

Sorry to bring that up again!

Quick summary for people that didn't follow it: LSB was implemented, and it was decided that "explicit calls" ( ClassName::method() ) wouldn't pass the caller info if no fallbacks occured. Some people that were looking forward to having LSB were disappointed as it meant that it wouldn't be possible to sanely overwrite a static method, without loosing info on the caller.

Quick POC: class A { public static function test() { echo get_called_class(); }} class B extends A { public static function test() { echo get_called_class(); parent::test(); } class C extends B; C::test(); // will output CA

To be able to pass information, it was decided to implement a call_user_func-like function that passed the caller info: forward_static_call(_array).

Back then, I was for that solution, but with some time I realized that it would probably be one of those decisions that would bite us back afterward.

To sum up key points about each possibilities:

1) forward_static_call + no need to affect the engine - slow, painful

2) parent:: carries the info while ParentClassName:: doesn't + convenient + no functionnality lost - introduces a difference between parent:: and classname::, but restricted to LSB so no BC break

It really seems like (2) is the most PHP way of doing things, while (1) is more of a hack that we will regret later. The only problem about (2) is that difference, but I really feel (and experienced in the multiple help channels that I'm in) that people already see (wrongly for now) classname:: and parent:: as slightly different. So introducing it as of 5_3 wouldn't be too much of a shock. The point is that: people who uses LSB will be aware of that difference and will use parent:: vs classname:: carefully, while others will be able to ignore it

So, I really would like to revert that foward_static_call stuff and implement the parent:: patch instead, while it's still possible.

thoughts?

Men never do evil so completely and cheerfully as when they do it from a religious conviction. -- Pascal