lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 16/07/2011 7.01, Ross Andrews wrote:
Yeah, I'm going to need to make another post about modules in 5.2 when
it's fully released.

Please, remember not to top-post. See below for the reply to your message.

On Fri, Jul 15, 2011 at 11:38 PM, Josh Simmons <
<>> wrote:

    On Sat, Jul 16, 2011 at 4:55 AM, Ross Andrews
    < <>> wrote:
     > Because it confused me, I thought some people on here might be
    interested: I
     > just made a blog post explaining why and how to use modules, and
    how they
     > work:
     > I'd love any feedback you all may have!
     > --Ross Andrews

    You might want to note that module is deprecated in 5.2 and not really
    needed in 5.1 anyway, avoiding all the environment tomfoolery.


Please note: it is not a new 5.2 approach. 5.2 simply officially deprecated a practice that was already considered somewhat harmful. The 5.1 module function has been considered "out of fashion" for rather a long time even in 5.1.

Lua 5.1 will be current yet for some time (BTW LuaJIT is 5.1 compatible and according to Mike Pall the switch to 5.2 won't happen in the near future). So the way you explain modules could lead a novice user to learn quite an old way of defining them (which involves subtle side effects too).

So adding a disclaimer or pointers to more current way of defining modules may be appropriate.

You might be interested in the following:

(There are other threads in the list about "module" function, that was the one I remembered better because I started it when I was a Lua newby and It contains various "wisdom gems" by other people, especially Roberto from Lua Team)

-- Lorenzo