Jay Zawrotny <jayzawrotny@gmail.com> writes:
> Random thought: Would there be any merit in implementing a system similar
> to Clojure's spec library, or similar 3rd party libraries for Fennel?
Yes, exactly. These all can be separate projects which build on each other:
* a vocabulary for describing types
* assertions for validating at runtime
* static analysis to detect conflicts based on direct type hints
* an inference engine which can detect conflicts across function call boundaries
* generators
Of course, the key is that you will end up with a different vocabulary
if you are looking for things which can be applied using static analysis
vs things which can be verified at runtime; for instance, tracking the
difference between positive numbers vs numbers, or the difference
between a UUID representation of a string vs a string.
I think there's room for a vocabulary which could do both; the inference
engine can make a best effort to detect conflicts where it can, but
maximum fidelity requires some runtime instrumentation.
The runtime version is also a lot easier to code, but I've been
impressed by the level of detail fennel-ls is able to accomplish with
its static analysis, especially for such a new codebase by one person,
so I wouldn't rule that out either.
-Phil