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

insert dynamic type checking code #109

Open
tmbdev opened this issue Jan 14, 2017 · 0 comments
Open

insert dynamic type checking code #109

tmbdev opened this issue Jan 14, 2017 · 0 comments

Comments

@tmbdev
Copy link

tmbdev commented Jan 14, 2017

I'd like to use typedlua to compile code for use in regular, dynamically typed Lua applications. That is, most of the code that will be using my code as a library is likely going to be not statically typed.

For that, I'd find it useful if there was an option to have typedlua insert type checking code at the boundary between dynamic Lua code and typedlua code.

Concretely, I'd find it useful if "typedlua -t example.lua" would transform something like this:

function f(x: string): string
    return x..x
end

into

f = function (x) 
  if type(x) ~= "string" then error("function f, argument x:string, got "..type(x)) end
  return x .. x
end
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

1 participant