Last modified: 2013-01-10 19:55:33 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T41494, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 39494 - Shared global scope + implicit globals are a bad fit for wiki templates
Shared global scope + implicit globals are a bad fit for wiki templates
Status: RESOLVED DUPLICATE of bug 39610
Product: MediaWiki extensions
Classification: Unclassified
Scribunto (Other open bugs)
All All
: Low normal (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2012-08-20 06:53 UTC by Ori Livneh
Modified: 2013-01-10 19:55 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Ori Livneh 2012-08-20 06:53:05 UTC
It's inelegant to have to explicitly export things when there is already a "local" keyword. Why not export everything non-local by default?

If that is not possible for some reason, why not initialize an empty table for each module, assign it a reserved name, and export it implicitly? I imagine something like this implicitly wrapping each module:

local module = {};
<<module code>>
return module;
Comment 1 Ori Livneh 2012-08-22 10:37:05 UTC
If you called the default module object "this", it'd behave exactly like a JavaScript constructor. I'd still prefer the former option, though (i.e., relying on the local keyword to assign to module or global scope).
Comment 2 Ori Livneh 2013-01-10 19:55:33 UTC
I did not articulate myself clearly in this report and bug 39610 has meanwhile become the locus of the conversation about scoping, so I'm closing this as a duplicate of that bug.

*** This bug has been marked as a duplicate of bug 39610 ***

Note You need to log in before you can comment on or make changes to this bug.