lua-users home
lua-l archive

Re: changes in 'require'

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


I have a third suggestion for a change to require:
Don't load the names into the global namespace by default. Modules can do
this themselves if they insist,but they generally shouldn't need to.
Argument in favor: It avoids code fragility from a missing require being
hidden by other modules happening to do the require.
Argument against: It complicates the command line environment.
I would be inclined to resolve the argument against by providing an easy way
to install an __index metamethod on the command-line globals environment
that automatically does the require and populates the globals.
Mark

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