moonscript.{loadfile,loadstring} incompatible with Lua's #87

Closed
nilnor opened this Issue Feb 24, 2013 · 2 comments

3 participants

@nilnor

The reference manual states that these work like Lua's, but they don't. Lua's follow the standard Lua idiom of returning nil plus and error message in cases of errors, whereas the moonscript counterpart just signals errors. The manual has it right imho - they should work like Lua's to avoid confusion.

@stevedonovan

I agree it would be less confusing, and more consistent. Generally Lua APIs only throw errors if there is a parameter error like an imcompatible type, whereas 'failing to compile' is a routine error for a compiler ;)

@SelectricSimian

I agree as well. I think the lua error handling system is perfect, actually. It's just lightweight enough that it doesn't get in the way, but when you need it its powerful enought to get the job done. And the convention of only signaling errors when it's the programmer's fault is clear, consistent, mostly unambiguous, and provides the most practical behavior in nearly every situation.

@leafo leafo closed this in cdd413a Mar 19, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment