I reply inline below, but in brief, my general questions have been answered. Thanks for the comprehensive reply.
On Mon, Jul 14, 2014 at 10:57 AM, Brad Jorsch (Anomie) < bjorsch@wikimedia.org> wrote:
On Mon, Jul 14, 2014 at 12:22 AM, gnosygnu gnosygnu@gmail.com wrote:
- Will Scribunto support Lua 5.2 in the future? According to this
comment,
it may:
https://github.com/wikimedia/mediawiki-extensions-Scribunto/blob/master/Scri...
It may someday, but there's no hurry to change over. And changing over will involve some rewriting of the sandboxing which will need security auditing.
See https://gerrit.wikimedia.org/r/#/c/139479/ for example.
Thanks for the link. I didn't know about the abandoned patch for 5.2, and Tim's replies and links to the lua mailing thread made for interesting reading.
Whenever Wikimedia decides to go to 5.2, the "intermediate runtime between 5.1 and 5.2" may be the best way. For what it's worth, I did the same in XOWA for Scribunto, and it wasn't that difficult. I used the Luaj project ( https://sourceforge.net/projects/luaj/files/luaj-3.0/3.0-beta2/), which is a pretty faithful port of Lua 5.2. I then added a handful of patches to be backward compatible with 5.1. The resulting version handles the Module code for all Mainspace/Wikipedia articles in 20+ wikis (enwiki; ruwiki; dewiki; enwiktionary; ruwikisource; etc). However, it didn't pick up more subtle issues like the "tonumber" one (which returns a different value and doesn't throw an error).
- If so, what is the best approach to ensure forward compatibility of
Module code for 5.2? Note that code that is valid for 5.1 may "break" in 5.2. (Again, see below for details) ** Should there be a reference page on MediaWiki or in the enwiki
Wikipedia
Namespace that details these breaking issues for other Module writers?
Feel free to create one.
Okay. I created https://www.mediawiki.org/wiki/Extension:Scribunto/Lua_5.2_changes and linked to it from https://www.mediawiki.org/wiki/Extension:Scribunto#Other_pages. Feel free to (re)move it as necessary.
** Or should 5.1 vs 5.2 issues be corrected on a case-by-case basis for each Module?
They'd have to be anyway.
Okay. I'll comment later on each of the cited Module's talk pages, and recommend changes as per this thread.
** Or should they be left as is, as any future-proofing may be
unnecessary
and / or premature?
Possibly.
Okay.
- Lastly, is there a general purpose mailing list for Scribunto issues?
I've had a few technical questions in the past that have been painful to sort out on my own. I'd like to think that there might be other Module writers who would also be interested in a mailing list as well.
No. There are various talk pages on enwiki and other wikis that are used for this purpose, although I don't remember the specifics offhand and am too lazy to search right now. ;)
Understood. For the record, I wasn't able to find a central hub / discussion page for Scribunto issues, though I'm probably looking in the wrong places.
- In contrast, Lua 5.2 has code that only cares if a base is not
specified.
// http://www.lua.org/source/5.2/lbaselib.c.html static int luaB_tonumber (lua_State *L) { if (lua_isnoneornil(L, 2)) { /* standard conversion */
** If a base is specified, Lua 5.2 will not do the standard conversion,
and
instead try to parse the number ** This parse code only accepts alpha-numeric characters. The dot is considered invalid, and any decimal number is converted to NIL
Possibly sensible since it removes a weird special case of base-10 being different from all other bases.
Agreed. The earlier version induced a few head-scratches, but I kind of wish the later version didn't just drop it altogether.
Finally, I've come across a related issue with the varargs operator ("..."). This operator is valid in 5.1, but not in 5.2. I've seen some Modules use this varargs operator, that will presumably just break in
5.2.
See https://en.wikipedia.org/wiki/Module:Horizontal_timeline and
"function
getNotNilValue(...)"
Note the 'arg' parameter is already deprecated in 5.1, so people should already be avoiding it. See http://www.lua.org/manual/5.1/manual.html#7.1
Agreed that it shouldn't be used. Unfortunately, there's at least one other user who didn't realize it was deprecated. That's why I recommended publicizing known 5.2 migration issues amongst Module editors. :)
-- Brad Jorsch (Anomie) Software Engineer Wikimedia Foundation _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l