[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Proposal: package.(c)path as tables
- From: Dirk Laurie <dirk.laurie@...>
- Date: Thu, 7 Sep 2017 05:38:39 +0200
2017-09-06 20:03 GMT+02:00 Martin <eden_martin_fuhrspam@gmx.de>:
> On 09/06/2017 12:32 PM, Dirk Laurie wrote:
>> 2017-09-06 10:26 GMT+02:00 Daurnimator <quae@daurnimator.com>:
>>> 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.
>>
>> local path = {}
>> package.path:gsub("[^;]*,function(x) path[#path+1]=x end
>>
>> A breaking change to save having to code that? DMML
>>
>
> String format for <package.path> looks like fossil from early versions.
You should not lightly make remarks like that. Lua does deliver "arg"
as a table, so the designers do take that possibility into account.
The reason for the string is that operating systems do it that way.
One gsub, and your package.path turns into the $PATH that the
operating system requires. It is the obvious and easy way to provide
the interface.
> To get terms (for example, when searching module "by hands") we have to
> implement our own parsing functions.
As I have demonstrated, if you want a table, it takes two lines to get it.