Board Thread:Watercooler/@comment-5590118-20150701035141/@comment-24473195-20150703123923

DarthKitty wrote:

This... isn't necessarily true. Take a look at Module:TableTools on Wikipedia for an example.

To get back to the original question, I think naming the global table  is a de facto standard; it's a best practice because people do it, and people do it because it's the best practice. Either way, I think there are three ways we can deal with this situation:


 * 1) Let devs name the global table whatever they want.
 * 2) * Pros: freedom
 * 3) * Cons: no consistency
 * 4) The global table should always be named.
 * 5) * Pros: short, follows the de facto standard
 * 6) * Cons: confusing(?)
 * 7) The global table should always be named.
 * 8) * Pros: very clear
 * 9) * Cons: long, doesn't follow the de facto standard

Related question: how do you guys feel about modules that return a single function, e.g. Yesno? In terms of coding practices, local variables shouldn't be accessible externally, but just about any function that is in a p table is accessible even in a page (using {{#invoke), although it will simply return nil.

There's one good thing about the defacto standard though, it is immediately easy to always see which functions are accessible without having to dig through the code to find out what the person named the external functions. It also avoids problems such as case sensitivity and all functions within a module become automatically re-usable by all modules. I'd say there are more pros than cons to keeping the status quo.

Related question: how do you guys feel about modules that return a single function, e.g. Yesno?

They are a necessarily evil only if a particular function is used in many modules. Although one could argue that the function should be part of a bigger module.