3 ms·
That’s a generic type, and that’s why they’re not enough. Here's a simple Python example: class Cents(int): pass def send_money(amount: Cents):
by acdha 4y ago
That’s a generic type, and that’s why they’re not enough. Here's a simple Python example:
class Cents(int): pass
def send_money(amount: Cents):
print(f"Sending ${amount / 100}")
send_money(42)
That’ll immediately fail validation without you needing to make sure you have tests which would catch every possible problem like that.
expected "Cents" [arg-type]
Found 1 error in 1 file (checked 1 source file)
In a language which has strict typing, you wouldn’t even be able to compile it.