luasocket icon indicating copy to clipboard operation
luasocket copied to clipboard

ltn12 should not export global table

Open johnd0e opened this issue 1 year ago • 3 comments

https://github.com/lunarmodules/luasocket/blob/1fad1626900a128be724cba9e9c19a6b2fe2bf6b/src/ltn12.lua#L16-L19

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.

johnd0e avatar Oct 28 '24 02:10 johnd0e

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.

alerque avatar Oct 28 '24 07:10 alerque

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.

johnd0e avatar Oct 28 '24 23:10 johnd0e

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.

catwell avatar Oct 29 '24 08:10 catwell