Rethink approach of 'dogfooding' in TypeCheck.Builtin module
Qqwy opened this issue · comments
As part of #186 , the @spec!
s in the TypeCheck.Builtin
module had to be changed to normal @spec
s 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.