Hey,
I just noticed wfRunHooks got deprecated. The hook mechanism is heavily depended on by extensions. So if it is going away, what will it be replaced by? There is no hint of this in the method doc.
Cheers
-- Jeroen De Dauw - http://www.bn2vs.com Software craftsmanship advocate Evil software architect at Wikimedia Germany ~=[,,_,,]:3
On Tue Jan 20 2015 at 4:20:47 PM Jeroen De Dauw jeroendedauw@gmail.com wrote:
Hey,
I just noticed wfRunHooks got deprecated. The hook mechanism is heavily depended on by extensions. So if it is going away, what will it be replaced by? There is no hint of this in the method doc.
Hooks::run().
-Chad
On 2015-01-20 4:21 PM, Chad wrote:
On Tue Jan 20 2015 at 4:20:47 PM Jeroen De Dauw jeroendedauw@gmail.com wrote:
Hey,
I just noticed wfRunHooks got deprecated. The hook mechanism is heavily depended on by extensions. So if it is going away, what will it be replaced by? There is no hint of this in the method doc.
Hooks::run().
-Chad
Heh, yay.
To bad we're not deprecating $wgHooks -> Hooks::register. I've had ideas that are impossible to do with $wgHooks.
((IIRC it was something about storing a light stack in debug mode of where Hooks::register is called so hook related errors, deprecation notices, etc... (or it might have been for a different kind of error) can actually tell you where the hook was registered))
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]
Hey,
Hooks::run()
Oh, in that case there is not much to worry about.
Added a note in https://gerrit.wikimedia.org/r/#/c/186115/1/includes/GlobalFunctions.php
Cheers
-- Jeroen De Dauw - http://www.bn2vs.com Software craftsmanship advocate Evil software architect at Wikimedia Germany ~=[,,_,,]:3
On Tue, Jan 20, 2015 at 4:21 PM, Chad innocentkiller@gmail.com wrote:
I just noticed wfRunHooks got deprecated. The hook mechanism is heavily depended on by extensions. So if it is going away, what will it be
replaced
by? There is no hint of this in the method doc.
Hooks::run().
Does the new syntax offer any advantage over the old one? Assuming that we want to switch to non-static function calls eventually (which I hope is the case), wouldn't it be friendlier towards extension maintainers to only deprecate once we are there, instead of forcing them to update twice?
Hey,
Does the new syntax offer any advantage over the old one?
Assuming that we want to switch to non-static function calls eventually (which I hope is the case), wouldn't it be friendlier towards extension maintainers to only deprecate once we are there, instead of forcing them to update twice?
Good points and questions. While this deprecation is not as problematic as simply ditching the current hook system altogether, it does indeed seem a bit of busy work.
The Hooks class has this comment "Used to supersede $wgHooks, because globals are EVIL.", which is quite amusing if you consider all fields and methods are static. So it's a switch from a global var to a global field, thus adding a second global to get rid of the first one. I have this presentation on static code which has a screenshot of this comment and class in it :)
Cheers
-- Jeroen De Dauw - http://www.bn2vs.com Software craftsmanship advocate Evil software architect at Wikimedia Germany ~=[,,_,,]:3
On Jan 21, 2015 1:40 PM, "Jeroen De Dauw" jeroendedauw@gmail.com wrote:
Hey,
Does the new syntax offer any advantage over the old one?
Assuming that we want to switch to non-static function calls eventually (which I hope is the case), wouldn't it be friendlier towards extension maintainers to only deprecate once we are there, instead of forcing
them to
update twice?
Good points and questions. While this deprecation is not as problematic as simply ditching the current hook system altogether, it does indeed seem a bit of busy work.
The Hooks class has this comment "Used to supersede $wgHooks, because globals are EVIL.", which is quite amusing if you consider all fields and methods are static. So it's a switch from a global var to a global field, thus adding a second global to get rid of the first one. I have this presentation on static code which has a screenshot of this comment and class in it :)
Cheers
-- Jeroen De Dauw - http://www.bn2vs.com Software craftsmanship advocate Evil software architect at Wikimedia Germany ~=[,,_,,]:3
Ill be honest i dont understand the point of deprecating that. As you say the evil globalness is the same amount of evil regardless of the type of global symbol. And really i dont think global hooks causes too many problems.
--bawolff
They probably could turn that global class into "facade" - compact form of IoC container Laravel framework uses. Dmitriy
On Thu, Jan 22, 2015 at 12:51 AM, Brian Wolff bawolff@gmail.com wrote:
On Jan 21, 2015 1:40 PM, "Jeroen De Dauw" jeroendedauw@gmail.com wrote:
Hey,
Does the new syntax offer any advantage over the old one?
Assuming that we want to switch to non-static function calls eventually (which I hope is the case), wouldn't it be friendlier towards extension maintainers to only deprecate once we are there, instead of forcing
them to
update twice?
Good points and questions. While this deprecation is not as problematic
as
simply ditching the current hook system altogether, it does indeed seem a bit of busy work.
The Hooks class has this comment "Used to supersede $wgHooks, because globals are EVIL.", which is quite amusing if you consider all fields and methods are static. So it's a switch from a global var to a global field, thus adding a second global to get rid of the first one. I have this presentation on static code which has a screenshot of this comment and class in it :)
Cheers
-- Jeroen De Dauw - http://www.bn2vs.com Software craftsmanship advocate Evil software architect at Wikimedia Germany ~=[,,_,,]:3
Ill be honest i dont understand the point of deprecating that. As you say the evil globalness is the same amount of evil regardless of the type of global symbol. And really i dont think global hooks causes too many problems.
--bawolff _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Legoktm legoktm.wikipedia@gmail.com writes:
On 01/21/2015 09:39 AM, Jeroen De Dauw wrote:
Hey,
Does the new syntax offer any advantage over the old one?
It's a little bit faster by cutting down one function call which adds up when a lot of hooks are called.
"adds up" is a poor defense for creating work for end users and developers. Has anyone actually measured what the difference is or is this just an example of premature optimization[1]?
Mark.
Footnotes: [1] http://en.wikipedia.org/wiki/Program_optimization#When_to_optimize
On Thursday, January 22, 2015, Mark A. Hershberger mah@nichework.com wrote:
Legoktm <legoktm.wikipedia@gmail.com javascript:;> writes:
On 01/21/2015 09:39 AM, Jeroen De Dauw wrote:
Hey,
Does the new syntax offer any advantage over the old one?
It's a little bit faster by cutting down one function call which adds up when a lot of hooks are called.
"adds up" is a poor defense for creating work for end users and developers. Has anyone actually measured what the difference is or is this just an example of premature optimization[1]?
Mark.
Footnotes: [1] http://en.wikipedia.org/wiki/Program_optimization#When_to_optimize
I don't have before/after measurements but Aaron started changing from
wfRunHooks to direct Hook calls based on data gathered from WMF production profiling. There was a non-trivial performance impact of the additional layer of indirection.
Bryan
On Thu Jan 22 2015 at 1:10:27 PM Bryan Davis bd808@wikimedia.org wrote:
On Thursday, January 22, 2015, Mark A. Hershberger mah@nichework.com wrote:
Legoktm <legoktm.wikipedia@gmail.com javascript:;> writes:
On 01/21/2015 09:39 AM, Jeroen De Dauw wrote:
Hey,
Does the new syntax offer any advantage over the old one?
It's a little bit faster by cutting down one function call which adds
up
when a lot of hooks are called.
"adds up" is a poor defense for creating work for end users and developers. Has anyone actually measured what the difference is or is this just an example of premature optimization[1]?
Mark.
Footnotes: [1] http://en.wikipedia.org/wiki/Program_optimization#When_to_optimize
I don't have before/after measurements but Aaron started changing from
wfRunHooks to direct Hook calls based on data gathered from WMF production profiling. There was a non-trivial performance impact of the additional layer of indirection.
Sure, but obvious performance gains are obvious. The real question to me is "was moving it into a static function inside of Hooks a benefit over it just being a global function?" My guess is no, not really.
-Chad
wikitech-l@lists.wikimedia.org