Those that break the naming scheme *somehow* is 7 extensions
(ArticlePlaceholder (mixed case), DynamicPageListEngine (not extension
name), JsonConfig (not extension name), LinkedWiki (not ext
structure), SemanticScribunto (not extension name), Wikibase Client
(not ext structure), ZeroPortal (not ext structure)) of a total of 17.
I have not counted two of my own that will not follow this scheme, and
Capiunto which use require. I have neither included TemplateData.
That is; the naming scheme is followed by approx 40% of the extensions.
There are probably some lua-libs I haven't found.
-- list --
# ArticlePlaceholder
mw.ext.articlePlaceholder
# TitleBlacklist
mw.ext.TitleBlacklist (Only a single method)
# BootstrapCompoinents
mw.bootstrap.*
# Capiunto
Doc says mw.capiunto, but this seems wrong
# Cargo
mw.ext.cargo
# DataTable2
mw.ext.datatable2
# DisplayTitle
mw.ext.displaytitle
# DynamicPageListEngine
mw.ext.dpl
# FlaggedRevs
mw.ext.FlaggedRevs
# Inference
Under development.
# JsonConfig
mw.ext.data.get
# LinkedWiki
mw.linkedwiki
# ParserFunctions
mw.ext.ParserFunctions (Only a single method)
# Pickle
Under development. Uses another loader.
# SemanticScribunto
mw.smw
# TimeConvert
mw.ext.timeconvert
# TitleBlacklist
mw.ext.TitleBlacklist
# VariablesLua
mw.ext.VariablesLua
# Wikibase Client
mw.wikibase
# ZeroPortal
mw.zeroportal
On Tue, Feb 5, 2019 at 5:50 PM Brad Jorsch (Anomie)
<bjorsch(a)wikimedia.org> wrote:
On Mon, Feb 4, 2019 at 5:26 PM Eran Rosenthal <eranroz89(a)gmail.com> wrote:
What is
the problem with the ".ext" part?
1. It adds unnecessary complexity both
in the extension (need to init
mw.ext if it doesn't exist)
It's one line in the boilerplate. That's not much complexity.
and more important - in its usage when the Lua
extension is invoked (longer names)
It's 4 characters. Also not much to be concerned about. You're also free to
do like
local foo = mw.ext.foo;
if you want shorter access within your code.
(there is very small risk of name collision -
mw.ModuleA and mw.ModuleB
are unlikely to clash as different extensions, and mw.ModuleA and mw.FUNC
are unlikely to clash because function names
<
https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Bas…
are usually verbs and extensions
<https://www.mediawiki.org/wiki/Category:All_extensions> are usually
nouns)
Scribunto has its own built-in packages too, which are also usually nouns.
What if, for example, Extension:Math
<https://www.mediawiki.org/wiki/Extension:Math> added a Scribunto module at
"mw.math" and then we also wanted to add a Scribunto-specific version of
Lua's
math library
<https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#Math_library>?
Or Extension:CSS <https://www.mediawiki.org/wiki/Extension:CSS> and a
Scribunto counterpart to mw.html
<https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_reference_manual#HTML_library>?
Or if Extension:UserFunctions
<https://www.mediawiki.org/wiki/Extension:UserFunctions> did its thing at
"mw.user" and then we got around to resolving T85419
<https://phabricator.wikimedia.org/T85419>?
Having mw.ext also makes it easier to identify extensions' additions,
avoiding confusion over whether "mw.foo" is part of Scribunto or comes from
another extension. And it means you can look in mw.ext to see which
extensions' additions are available rather than having to filter them out
of mw.
BTW, we have "mw" in the first place to similarly bundle Scribunto's
additions away from things that come with standard Lua. If someday standard
Lua includes its own "ustring" or something else Scribunto adds a module
for (and we upgrade from Lua 5.1), we won't need to worry about name
collision there either.
2. Practically the convention is to not use
mw.ext - the convention (based
on most of the Lua code - e.g wikibase) is to not use mw.ext
Of extensions in Gerrit (as of a few days ago when I last checked),
Wikibase and LinkedWiki seem to be the only two extensions not using
mw.ext, while Cargo, DataTable2, DisplayTitle, DynamicPageListEngine,
FlaggedRevs, JsonConfig, ParserFunctions, and TitleBlacklist all do.
--
Brad Jorsch (Anomie)
Senior Software Engineer
Wikimedia Foundation
_______________________________________________
Wikitech-l mailing list
Wikitech-l(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l