Simetrical wrote:
On 9/9/07, Tim Starling tstarling@wikimedia.org wrote:
[...]
You don't gain any flexibility by having the "global $wgUser" in the caller instead of the callee.
Sure you do, because other callers can use other Users.
And in 99% of code there is no application for multiple user objects.
What's a method where there could be no possible benefit from allowing it to deal with users other than the one generating the web request (if applicable)?
Methods don't exist in a vacuum, they exist to support certain public user interface operations, such as:
* Page view * Edit * Upload * RC * Watchlist * Login
Out of those six operations, only edit requires dealing with multiple user objects, and only then in a small, self-contained file (UserMailer). Login briefly has two user objects in existence, but for the most part, it works by changing the global context.
If I may turn the question around, what do you envisage to be the applications for, say, the $user parameter to ParserOptions::__construct()?
-- Tim Starling