Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: keep line number when compiling #312

Open
buckle2000 opened this issue Dec 9, 2016 · 10 comments
Open

Feature: keep line number when compiling #312

buckle2000 opened this issue Dec 9, 2016 · 10 comments

Comments

@buckle2000
Copy link

buckle2000 commented Dec 9, 2016

Since lua is whitespace-insentitive, why not just squeeze code together?
Probably working fork

Will close #311.

@buckle2000
Copy link
Author

buckle2000 commented Dec 9, 2016

What we can do further is to trimmer unnecessary spaces.
There is also a bug about multi-line strings, please refer to BUG in the code.

@leafo
Copy link
Owner

leafo commented Dec 9, 2016

I think people prefer to have readable code than compressed code. If we were going to compress the code, then we might as well compress it as much as possible.

What's the use case for trying to keep the line numbers? Having stack trace errors that work without rewriting?

@buckle2000
Copy link
Author

Exactly. Current version cannot rewrite traceback in luajit correctly, in my case, love2d.

@TangentFoxy
Copy link

Usually it's not hard to work out the trace from the Lua back to MoonScript.. that said, it would be nice if error messages were more traceable.. but I also like having fairly readable output.

Perhaps a command-line switch to compile in a mode that preserves line numbers? @buckle2000 This might not do what you want though. Sometimes errors in the output Lua aren't so easily traced, and doing things this way would actually make it more difficult to trace because of the loss in readability...

@buckle2000
Copy link
Author

You are right. It is not hard to find corresponding moonscript from Lua but it's annoying since most bugs are caused by writing mistakes, not logical mistakes, missing comma for example. Given the line number, these bugs can be easily fixed.

@ThaisRobba
Copy link

As an FYI, I have been using buckle's branch and having the correct lines in development so far has been really helpful!

@buckle2000
Copy link
Author

@OttoRobba Thanks for your proof of concept!

@sherjilozair
Copy link

@leafo Is it possible to display correct error messages when using moonscript and love2d? Having to read compiled lua code to debug is not fun at all.

@fendrin
Copy link

fendrin commented Jun 19, 2018

@ChildishGiant
Copy link

Is there any chance of this ever being merged? It'd make debugging errors far easier as often I find myself with an error on a line that doesn't even exist in the source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants