4 ms·
I like this sort of idea for typifying dynamic languages (like JS) What if instead of TS, you had plain JS as-is (no compiler needed!) then just add comment li
by quickthrower2 3y ago
I like this sort of idea for typifying dynamic languages (like JS)
What if instead of TS, you had plain JS as-is (no compiler needed!) then just add comment like:
/* x is an integer, x > 0 ... */
function add(x, y) { ...
Sorry the example ain't great but the point is that you can be precise with refinement types. I think refinement types (less all the mathy explanations) are more intuitive. They would be like assertions or C# code contracts. The content of those types would look "business-ey" rather than "category theory-ish".
- __vec__ 3y agoThe difference is an informative error message at compile time when such fails to satisfy the 'refinement'