News for hackers. Stuff that matters.
Re:A Gentle Introduction to Liquid Types by quickthrower2 on Sunday September 03, 2023 @09:33PM (#37376333)
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".
Re:A Gentle Introduction to Liquid Types by __vec__ on Sunday September 03, 2023 @09:37PM (#37376357)
The difference is an informative error message at compile time when such fails to satisfy the 'refinement'