3 ms·
I still use and love that contracts library, so thank you. Sure, it’s not the same as static typing, but for me it’s broadly better. To take a simple example,
by gsinclair 3y ago
I still use and love that contracts library, so thank you.
Sure, it’s not the same as static typing, but for me it’s broadly better. To take a simple example, static typing can’t guarantee an argument is a natural number, as opposed to an (edit: integer).
- egonschiele 3y agoThanks, I’m so glad you like it. I loved contracts 10 years ago. If Ruby was simpler language, I would have taken a stab at building static type checker.
- IshKebab 3y agoStatic typing can guarantee that if you design your static typing system to allow it. Take a look at Rust's NonZero types for example. Languages with dependent types can do even more. Of course that is much more complicated and at some point you can only check the type at runtime. But the idea that static type checking is worse than runtime type checking because it can't do all the checks is idiotic. You're throwing out the static benefits for no reason. You should use static types as much as possible, and runtime checking where that isn't enough.