lua-users home
lua-l archive

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


On Tue, Jan 25, 2011 at 00:50, David Given <dg@cowlark.com> wrote:
> On 24/01/11 06:46, steve donovan wrote:
> [...]
>> One could add @line directives to Lua with a token filter, but I also
>> doubt that the token filter patch will ever make mainstream, for
>> similar reasons to 'goto'.

> Interestingly enough, the absence of a @line directive in Lua is
> crippling Objective Lua's ability to be useful. If I could emit the
> generated source in a different order to the input source, I could use a
> vastly more efficient object model. But as it is, I can't, and I have to
> jump through many hoops (including having to enforce certain syntactical
> rules!) simply in order to get the debugging information correct.

I miss something like @line too.

I generate a lot of Lua code nowadays, and error messages that point
to the generated code are a bit annoying.

I plan to experiment with beating this by writing error message
filter, which would use a stored mapping of generated code to source
code file/line ranges, and do a gsub before spitting out an error.
Loading of that mapping should be delayed until the actual error
happens, so it should not bring too much overhead...

I would patch file/line information in the bytecode, but I can't
because I use LuaJIT 2...

Alexander.