lua-users home
lua-l archive

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

On Wed, Sep 6, 2017 at 1:26 AM, Daurnimator <> wrote:
> At the moment, package.path and package.cpath are strings containing
> semicolon separated lists.
> I'd like to propose that they are transitioned to be sequences to
> allow for easier programmatic manipulation.
> The environment variables LUA_PATH, LUA_PATH_5_4, LUA_CPATH, etc
> wouldn't change: they'd just need to be parsed when the package
> library is loaded.
> In the next release we can allow package.path and package.cpath to be
> strings for compatibility.
> However the construct `package.path = package.path ..
> ";/my/path/?.lua" would break and need to be changed to
> `table.insert(package.path, "/my/path/?.lua")`
> If this breakage is too much, perhaps we could have three phases:
>   - phase 1. we allow table form, but still use string form on lua
> command line application load.
>   - phase 2. we change the default to be table form; string form is deprecated
>   - phase 3. we remove support for string form.

I personally think parsing strings is for the birds (and Dirk and Sean
apparently. Thanks for those little nuggets) but can you provide some
concrete examples of where this would improve the language? Speed,
reliability, readability? Do you have a need to be adding and removing
many items to the path during runtime where this would be useful?