On Fri, Sep 29, 2017 at 7:05 AM, mathieu stumpf guntz <
[email protected]> wrote:

> Well, it's nothing functionally important, but I was wondering what the
> "p" initial was for, as it's used everywhere as the returned value by
> modules.


"package", I believe. As noted, nothing actually requires that the variable
be named "p", that's just the convention. For that matter, nothing requires
the variable even exist. You could have a module return the method table
directly, like

return {
    hello = function () return "Hello, world!" end
}

and that would be valid. But for a long module that might get hard to read,
and wouldn't allow one method to call another if necessary.


On Fri, Sep 29, 2017 at 7:40 AM, mathieu stumpf guntz <
[email protected]> wrote:

> Where? In the reference manual, it's `p` which is used. Should it be
> updated with `_module`?
>
> But I'm affraid that could lead to confusion for beginners when the
> console require to use `p`.
> What about alliasing `p` with `_module`, and even `m` in the scribunto
> console?


Let's not overcomplicate everything. If someone would rather use "_module"
or "m" in the console, they can always enter "_module = p" or the like
before starting their testing.


-- 
Brad Jorsch (Anomie)
Senior Software Engineer
Wikimedia Foundation
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to