Page MenuHomePhabricator

Consider implementing Module:No globals / Log globals in Scribunto itself
Open, LowestPublic

Description

https://en.wikipedia.org/wiki/Module:No_globals
https://en.wikipedia.org/wiki/Module:Log_globals

This is a rather widely used module on enwp that prevents the usage of global variables. It seems like this would be useful to have integrated into Scribunto itself (working on the assumption that globals should be avoided).

Event Timeline

Legoktm created this task.Nov 12 2018, 8:35 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 12 2018, 8:35 PM
Anomie triaged this task as Lowest priority.Nov 13 2018, 2:24 PM
Anomie added a subscriber: Anomie.

(working on the assumption that globals should be avoided)

That indeed is an assumption. I see no particular reason for Scribunto to enforce this.

If someone wanted to make it a pure-Lua library like bit32.lua that people could load on demand, meh. It would have to be relicensed or reimplemented though.

(working on the assumption that globals should be avoided)

That indeed is an assumption. I see no particular reason for Scribunto to enforce this.

I based it off of http://lua-users.org/wiki/ScopeTutorial, which says:

The general rule is to always use local variables, unless it's necessary for every part of your program to be able to access the variable (which is very rare).

Also partly my Python-bias where things are local by default, and that's the way I expect it.

If someone wanted to make it a pure-Lua library like bit32.lua that people could load on demand, meh. It would have to be relicensed or reimplemented though.

Ack, yeah, I was thinking it would roughly work the same in that people would need to manually require/enable it.

Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptNov 15 2019, 3:44 PM