lua-users home
lua-l archive

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


Hi!

Lua silently assumes that current file system is case-sensitive (as in POSIX).
This leads to incorrect behavior on OS with case-insensitive file systems.

On POSIX, every module has unique name (Lua string) derived from its file name.
But on Windows "some_module.lua" does not have a unique Lua string for its name.
All variants are equally valid as they refer to the same file:
require("some_module")
require("Some_module")
require("Some_Module")
Obviously, none of them is better then others.
If this module is used on POSIX systems then we may derive its "proper" name from its POSIX file name.
But if this module is designed for using on Windows only then we do not have a fulcrum.
A developer may choose letter case depending on his programming style according to naming convention:
local useful_utils = require("some_module")
local Useful_utils = require("Some_module")
local Useful_Utils = require("Some_Module")
This can break main principle of require() "every module is loaded only once" if a project consists of code written by different developers using different coding styles.

To avoid multiple instances of the same module, package.loaded on Windows should contain only lowercase package names.

-- Egor