lua-users home
lua-l archive

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


PA wrote:


...
In other words, anything goes :)

It would be nice though to have a consistent behavior, e.g. 'require' always returning a table of functions, instead of the current unpredictable situation...

On the other hand, well, it's not such a big issue in practice as you are most likely in full control of your environment and can impose whatever policy you see fit.

Right, but this does not scale well. It requires that anyone using any package has to understand the rules of that package. That does not bode well for wide adoption of Lua and its very nice array of supporting packages. Seems like it would be better if require did some checks to ensure that rules were being followed. For instance, it could prevent the package being loaded from putting things into the global table. And it could throw an error if the return value was not a table.

And hopefully the doc describing how to create a package will lay out some conventions, so at least there will be guidelines on how to conform.

--
chris marrin              ,""$, "As a general rule,don't solve puzzles
chris@marrin.com        b`    $  that open portals to Hell" ,,.
        ,.`           ,b`    ,`                            , 1$'
     ,|`             mP    ,`                              :$$'     ,mm
   ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
  m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
 b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
 ```"```'"    `"`         `""`        ""`                          ,P`