lua-users home
lua-l archive

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


With 5.2 getting so near completion, I feel it's worth bringing up a
couple small enhancement ideas I had in hopes they might be considered
for inclusion in the official release:

1) A way to disable tail calls, to make debug tracebacks more useful.

2) A new string pattern %i, that matches all legal identifiers. It'd
be a little more readable than writing [%w_] (if that's even
correct?).

3) Have assert() accept any type for its second argument. i.e. in 5.1,
you can do this:
> error({})
(error object is not a string)
but:
> assert(false, {})
stdin:1: bad argument #2 to 'assert' (string expected, got table)
which seems a bit odd to me. In particular, allowing assert() to throw
a function as an error object would address the situation mentioned in
another recent thread, where a construct like assert(f(), g()) has to
call g (which may be expensive) even if f succeeds. You could instead
write: assert(f(), g), and when you catch the error, call it there.

Thoughts, feedback, flames, poetry? :)

-- 
Sent from my toaster.