latex3 / l3build

A testing and building system for LaTeX
LaTeX Project Public License v1.3c
84 stars 14 forks source link

better escapepath #378

Closed jlaurens closed 6 days ago

jlaurens commented 1 week ago

Improvements

  1. as os.type is a constant, put the os.type == ... test out of the function such that the test is performed only once instead of on each call
  2. replace exit with assert. Using exit at the top level is ok but not in the middle of nowhere. With assertwe can use pcall and deal with errors without terminating the program abruptly.
  3. on the "unix" side, escapepath returned 2 values instead of one. This is not a problem now but could be in the future when used as argument to a function:
    function f(...)
    for i,j in ipairs{...} do
    print(i.."->"..j)
    end
    end
    f(string.gsub("aaa","a","c"))
    f(string.gsub("aaa","a","c"),10)

    Both calls have exactly the same number of arguments.

jlaurens commented 1 week ago

After some thoughts, I have to explore the other solution to return nil + an error message instead of raising.

jlaurens commented 1 week ago

That would make too much changes in the code