Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ltn12 should not export global table #443

Open
johnd0e opened this issue Oct 28, 2024 · 3 comments
Open

ltn12 should not export global table #443

johnd0e opened this issue Oct 28, 2024 · 3 comments

Comments

@johnd0e
Copy link

johnd0e commented Oct 28, 2024

luasocket/src/ltn12.lua

Lines 16 to 19 in 1fad162

local _M = {}
if module then -- heuristic for exporting a global package table
ltn12 = _M -- luacheck: ignore
end

module function exists in 5.1 (in 5.2 manual it is referenced as deprecated).
Still nobody nowadays expect that module exports globals.
Nor other (sub)modules of luasocket do that.

@alerque
Copy link
Member

alerque commented Oct 28, 2024

I agree this should be removed, but doing so will probably warrant a breaking release semver bump because it will not be a smooth upgrade path for anybody that was relying on this quirk.

@johnd0e
Copy link
Author

johnd0e commented Oct 28, 2024

I tend to view that as fixing a bug, which only requires a minor version bump. Of course, there may be someone who relies on the bug in their own workflow, but it is still a bug.

@catwell
Copy link
Member

catwell commented Oct 29, 2024

A long time ago almost all Lua modules used to export a global. ltn12 is a module from that era and used in a lot of places. So yes I can guarantee you changing this will break code, it should be done in a major revision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants