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

code generator #16

Open
leafo opened this issue Oct 30, 2022 · 0 comments
Open

code generator #16

leafo opened this issue Oct 30, 2022 · 0 comments

Comments

@leafo
Copy link
Owner

leafo commented Oct 30, 2022

add to-lua compiler for type checkers for improved performance. Because performance is highest priority, optimize out error messages since they currently generate a lot of work when going down invalid paths.

Possible interface:

types.string\compile! -> plain old lua function that performs the transformation

Exploration

It probably makes sense to manually write out optimized version of code for different composite types to understand how things should be structured. We probably have to support fallback for when types can't be compiled, they can be turne d

-- types.string
local value, state = ...
if type(value) == "string" then
  return true, state
end
return nil
-- types.string + types.nil
local value, state = ...
if type(value) == "string" then
  return true, state
end

if value == nil then
  return true
end

return nil

Other ideas

  • Have JIT compiling for type checkers that are hot
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