lua: implement searchers for preload and builtin
This patch initiates the refactoring of Tarantool package.loaders required for Tarantool integrity protection. Since Tarantool follows Lua 5.1[1] semantics, the set of routines in package.loaders is used to tweak Lua modules loading. E.g. overriding machinery has been implemented on top of the package.loaders. Unfortunately, package.loaders are not as flexible as they should be and this mechanism is redesigned in Lua 5.2[2]. Starting from Lua 5.2 package.loaders has been superseded by package.searchers. This is quite a natural change, since nobody wants to tweak the "loading" rules, but rather the "searching" process. As a result of this redesign evolution up to the Lua 5.4[3], users are able to obtain the "source" of the module being loaded (i.e. file name or specific sentinel for preload packages). This patch introduces Tarantool internal table with package.searchers and reimplements package.preload and tarantool.builtin loaders using the machinery described above: * The new searcher function, respecting Lua 5.4 semantics, is implemented for each loader. * Each searcher is wrapped with the function to implement "dummy" loader respecting Lua 5.1 semantics. [1]: https://www.lua.org/manual/5.1/manual.html [2]: https://www.lua.org/manual/5.2/manual.html [3]: https://www.lua.org/manual/5.4/manual.html Needed for tarantool/tarantool-ee#585 NO_DOC=refactoring NO_TEST=refactoring NO_CHANGELOG=refactoring
Loading
Please register or sign in to comment