lua-users home
lua-l archive

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


Diego Nehab wrote:
hi,

I have been thinking about the idea of importing names,
like what python does with its various flavors of import
statement. This goes along with requiring modules that do
not put themselves into the global namespace.


The only problem with opening a package into the global
namespace is that, usually, packages refer to internal
symbols by referencing the namespace table directly. So, if
your package exports a variable, you will have made a copy
of it. Changes to that variable made in the global copy
won't  be visible to the package implementation.

Arguably this is a bad choice for the package interface
anyways (oh wait, LuaSocket does this). I am just letting
you know you might hit this kind of issue.

Right. That's why I played it safe and only imported the functions.

--
chris marrin                ,""$,
chris@marrin.com          b`    $                             ,,.
                        mP     b'                            , 1$'
        ,.`           ,b`    ,`                              :$$'
     ,|`             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`
"As a general rule,don't solve puzzles that open portals to Hell"'