Page MenuHomePhabricator

Lua: allow mw.loadData to be used transitively.
Open, Needs TriagePublicFeature

Description

Feature summary (what you would like to be able to do and where):

I would like to be able to call mw.loadData in data modules that are themselves called by mw.loadData. This is currently not possible, because tables returned by mw.loadData are given a metatable, but the data to be returned must not itself have a metatable.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):

On the English Wiktionary, this would be useful for the 28 language data modules (1 for 2-letter codes, 26 for 3-letter codes, and 1 for nonstandard codes): these each call require on a central data module. This is partly a convenience measure, but also (more importantly) a way to add shared data used by certain groups of languages, so as to keep them synchronised.

These data modules are accessed via mw.loadData calls by Module:languages (and its submodules), which means that it is not possible to use mw.loadData within them to call the central data module.

Benefits (why should this be implemented?):

This would avoid having up to 28 copies of the central data module being held in memory, which will help with the English Wiktionary's severe, ongoing problems with the Lua memory limit.