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

Custom type checking for custom types #661

Open
OrfeasZ opened this issue May 18, 2023 · 1 comment
Open

Custom type checking for custom types #661

OrfeasZ opened this issue May 18, 2023 · 1 comment
Labels
feature request New feature or request

Comments

@OrfeasZ
Copy link

OrfeasZ commented May 18, 2023

Is it possible to make teal generate custom type checking code when using the is operator instead of checking using type()?

For example, in my lua implementation, all custom types have an Is method which can be used to determine their type if needed, like this:

if x:Is('SomeType') then
  -- Do something with x
end

Is there a way (eg. using some annotation) to make it so the following teal code gets transpiled to the code above, when x is declared as some record userdata type?

if x is SomeType then
  -- Do something with x
end
@hishamhm hishamhm added the feature request New feature or request label May 18, 2023
@hishamhm
Copy link
Member

@OrfeasZ not yet, but this is something I want to implement. Something along these lines should come with the interfaces implementation, which should cover this, as well as #655 (and possibly other related feature requests).

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

No branches or pull requests

2 participants