Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
ANRC Universe
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module talk:Namespace detect
(section)
Add topic
Module
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Add topic
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Module:Namespace detect/data == <small>Moved from my talk page. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 14:30, 25 March 2014 (UTC)</small> Hello. Is there any good reason to include <code>local cfg = require('Module:Namespace detect/config')</code> on enwiki. The config file is "empty". [[User:Christian75|Christian75]] ([[User talk:Christian75|talk]]) 09:13, 25 March 2014 (UTC) :The module needs to check the /config page to see if there are any configuration differences that it needs to process. This allows us to use the same basic code on enwiki as on other wikis using different languages. If those differences weren't in the /config file, they would have to be put in the main module code, which would mean we would have to produce different modules for all the different languages we wanted to localise to. It's a labour-saving device - if we didn't do the localisation work here, it would fall to editors on the different wikis to directly alter the module code. I would guess that this way of doing things is much easier for editors working in localisation to understand. If you're worried about performance, the /data page is loaded with mw.loadData, which means the config table is cached per page, so the overhead in loading it is minimal. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 14:38, 25 March 2014 (UTC) :: or we could just change: <syntaxhighlight lang=lua>local cfg = require('Module:Namespace detect/config')</syntaxhighlight> with <syntaxhighlight lang=lua>-- local cfg = require('Module:Namespace detect/config') -- enable this line and disable the next line if you want to localize the output local cfg = {}</syntaxhighlight> Its 9,900,000 transclusions of nothing at enwiki. [[User:Christian75|Christian75]] ([[User talk:Christian75|talk]]) 10:35, 26 March 2014 (UTC) :::We could, but then that would mean that users would have to edit the module code to configure the module, rather than just the configuration file. I'd rather only do this if there is a real problem with loading the config file on enwiki, and I don't think the module having a high transclusion count is really enough of a reason. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 11:01, 26 March 2014 (UTC) ::::If it were a problem, it would be possible to have a "no config" argument passed to the module, and if that were set, it would skip loading the config. However, I agree with Mr. Stradivarius—the overhead is probably very small, and there is no evidence that omitting the config would achieve anything. Even if requiring a module took a significant time (it doesn't), the caching of the 9.9 million pages means that the require overhead would still be small. What I find interesting is that the main module uses "loadData" on the data module, and the latter uses "require" on the config module. I wonder what would happen if something prohibited by loadData were in config. I'll have to run a test one day. [[User:Johnuniq|Johnuniq]] ([[User talk:Johnuniq|talk]]) 11:27, 26 March 2014 (UTC) :::::mw.loadData scans the table it is passed to make sure it hasn't received any invalid data. ([https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FScribunto/b66ae0671335ae31798769d5e3382b136d0614b7/engines%2FLuaCommon%2Flualib%2Fmw.lua#L746 Here's] the validation code.) So the invalid data would get through to the /data page fine, but when the table is loaded from /data to the main module it would cause an error. But yes, try it and see for yourself. :) — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 12:39, 26 March 2014 (UTC) :::::Also, checking a "no config" argument may have a bigger overhead than loading the /config module, especially seeing as an argument would be checked once per #invoke and not once per page. I'd be interested to see the numbers for that if anyone feels like setting up a test. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 12:49, 26 March 2014 (UTC) ::::::I don't see harm in loading a "blank" config. I think it would just overcomplicate it to add any such checks. [[User:Jackmcbarn|Jackmcbarn]] ([[User talk:Jackmcbarn|talk]]) 21:25, 27 March 2014 (UTC)
Summary:
Please note that all contributions to ANRC Universe may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
ANRC Universe:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Module talk:Namespace detect
(section)
Add topic