Repository navigation
C library members typed as any - #3487
jonathandw743 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
中文:该改动将 ffi.namespace 的索引字段类型从 function 放宽为 any,这与 LuaJIT FFI 的实际语义一致:ffi.C 命名空间下既可访问函数(如 ffi.C.printf),也可访问变量/常量(如 ffi.C.errno、ffi.C.EAGAIN),因此原类型标注不准确,此修改是合理的修正。未发现 bug、安全或回归问题。建议确认下游是否有依赖旧类型 function 做类型检查或代码生成的工具,若有需同步更新。
English: This change relaxes the indexed field type of ffi.namespace from function to any, which matches LuaJIT FFI's actual semantics: the ffi.C namespace exposes both functions (e.g. ffi.C.printf) and variables/constants (e.g. ffi.C.errno, ffi.C.EAGAIN), so the previous annotation was inaccurate and this fix is reasonable. No bugs, security issues, or regressions found. Recommend verifying whether any downstream tooling relies on the old function type for type checking or code generation, and update it if so.
C library members are not always functions, they may be global variables.