Comment

Comment by disnet

Well, CoffeeScript/JavaScript doesn't have a static type system. And to add one would be...hard.

But we would still like to express and enforce some invariants about our code. And we'd like to do it in a more elegant way than constantly writing "if(argument === ...) then ... else ..."

Contracts also allow us to check invariants that might not result in a run-time exception but could lead to the code just being subtly wrong.

parent disnet 15 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton