lua-users home
lua-l archive

Re: GCed dynamic libraries

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


Roberto Ierusalimschy wrote:
>
> If I understand it correctly, your idea of different registries for
> C functions mimics the environment system of Lua functions. Each C
> function has its own registry (in the same way that each Lua function
> has its own environment). New functions share the table of its
> creator. The main function of a new library creates a new environment
> (registry) to be shared by all functions of that library.
> 
> Is that understanding correct?
Yes. Except, it's not the main function of a library that creates
the new registry but the library loader.
Hmm... just in case you want to extend the "function environment" to
C-functions by replacing the private registry with private globals:
I still think, that the per Lua-function global table (the "environ-
ment") was a bad idea. Globals are for communication "between"
modules, the local registries for private storage. The "function
environment" as found in Lua 5 combines these two concepts and the
result is difficult to use and has weird semantics.
So, please, don't do that.
Ciao, ET.

AltStyle によって変換されたページ (->オリジナル) /