lua-users home
lua-l archive

Re: Private modules, was Calling module from a C function

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


	Hi Thomas
On 2007年4月26日, Thomas Lauer wrote:
> Tomas Guisasola Gorham <tomas@tecgraf.puc-rio.br> wrote:
> > 	I mean:
> > 
> > == A.lua ==
> > module"A"
> > g = 10
> > function f (x) return x+g end
> > 
> > == B.lua ==
> > local A = require"A"
> > module"B"
> > g = 20
> > import_f_from_A
> > 
> > 	What will be the result of B.f(2) ?
> 
> Did you try?
	Surelly not. There is no `import_f_from_A'. I was just
trying to understand the semantics of this import function you
were proposing.
> > > Alas, doing this would break most existing module code.
> > 	Why?
> 
> I can't see how the current module system would cleanly refer to more
> than one parameter, given that module()'s list of optional parameters
> (after the name) is a list of functions to be applied over the module.
	Yes, code like `module(...)' will not work if required
with more than one argument (supposing `require' will pass them
to the module).
	Regards,
		Tomás

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