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

Rethink approach of 'dogfooding' in TypeCheck.Builtin module #187

Open
Qqwy opened this issue Jul 4, 2023 · 0 comments
Open

Rethink approach of 'dogfooding' in TypeCheck.Builtin module #187

Qqwy opened this issue Jul 4, 2023 · 0 comments

Comments

@Qqwy
Copy link
Owner

Qqwy commented Jul 4, 2023

As part of #186 , the @spec!s in the TypeCheck.Builtin module had to be changed to normal @specs that do not perform type-checking to make the library compile and run correctly on Elixir v1.15.

This is unfortunate, because dogfooding the type-checking logic is a very worthwhile feature: When you use TypeCheck in your code, you get compile-time errors if you make a mistake in TypeCheck's syntax.

The technique used before, where TypeCheck.Builtin would be compiled twice, with the second compilation injecting checks by running code from the first compilation, is off the table.

Some possible alternatives which need to be investigated for feasability:

  • Still compile the module twice, but under different names: Quote the module contents and define two modules with these contents (with the second module including the former).
  • Just write the typechecks manually by adding calls to TypeCheck.conforms! inside the function definitions.
  • There may be more.
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