On Wed, 03 Apr 2013 22:15:27 -0700, Jeroen De Dauw jeroendedauw@gmail.com wrote:
Hey,
I see no reason to get rid of the hooks class.
Given you also do not understand why I think the comment is funny, I recommend you read up on why writing static code is harmful. And on how global state can hide in static "classes".
Maybe you should try linking to a specific reason.
I understand perfectly fine that globals and static classes both have global state. But I also understand that classes even when static still have advantages over functions and global variables.
Hook registration is a matter of connecting core code paths to extension code paths. It is pretty much inherently a static operation.
I was also trying to make sure that you were in fact commenting on "globals are evil" and not mistaking "Used to supersede $wgHooks" for something like "This was written to supersede $wgHooks but no-one uses it so it doesn't supersede $wgHooks anymore".
We use static classes other places in core.
https://yourlogicalfallacyis.com/bandwagon
In almost all such cases I have seen in core this kind of use of static is bad.
Linker, Html, and Xml included?
MWNamespace could use some instance methods.
But registering hooks is pretty much a static operation when extensions themselves are basically static things that we don't load as an instance.
In any case you're cherry picking sentences from a paragraph of things that belong together. That borders on https://yourlogicalfallacyis.com/strawman and maybe https://yourlogicalfallacyis.com/the-fallacy-fallacy
I never implied that just because we use static classes elsewhere in core that it alone was a reason to use a static class. "We use static classes other places in core. And there's no reason to revert to hideous functions like we had before." Was supposed to be read together. And was meant to indicate that using static methods instead of functions is not out of step with our coding guidelines.
And there's no reason to revert to hideous functions like we had before.
No one is suggesting that.
Then instead of talking about removing the Hooks class why don't you try instead talking about what kind of hooks system we should create to supersede the Hooks class.
Usually when someone talks about deprecating and "removing" something static that replaces something static they're not talking about replacing it with something non-static. Nothing about your message read as "Lets replace Hooks with something non-static". It read much more clearly as "No one is using Hooks, how about we kill it".
Cheers
-- Jeroen De Dauw http://www.bn2vs.com Don't panic. Don't be evil. -- _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l