-
Notifications
You must be signed in to change notification settings - Fork 3
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
Throw exceptions instead of erroring #64
Comments
That sounds good to me. A check in the callers side would still be necessary, wouldn't it? Because I would like to have exceptions just bubbeling up, like in Java. EDIT: I hate auto-correction... |
I don't even. |
Well, it would probaby also be a lot oft recoding, so anyway. |
The only thing that would change how it does its call I think would be the part of createCodeFunction that tailcalls the compiled method. Not at my computer at the moment so I can't copy paste but here's sort of how I think it'd look. function createCodeFunction(blahParams)
local rti, f
return function(...)
if not f then
f, rti = compile(blahParams)
end
return ecall(f, ...)
end
end I don't think there's any other places that would need to be ecall'd |
There are several areas that can error in the process of compiling a method. I think I'd like to wrap several places in pcalls in such a way that the error message is converted to an exception and thrown. Mainly, there'd be a function called "ecall", that is used in the spots where methods get called. Its purpose is to call a method and if it errors, it will catch it from pcall, produce an exception built around the error message, and
return nil, exception
, effectively throwing the exception. Otherwise, it will return what the method returns.The text was updated successfully, but these errors were encountered: