logoalt Hacker News

slightwinderyesterday at 2:39 PM1 replyview on HN

> Dependent types are very useful for some things. For example, I wish Python had the ability to express "a 10 x 5 matrix of float32s" as a type, and typecheck that.

What do you mean? Every class is a type, so create your own class and control what goes in.


Replies

_seyesterday at 2:55 PM

Type checking is done statically without running the program. You don't need to execute any run-time logic to perform a check like this. What you are suggesting is a much, much weaker form of verification that doesn't require any type system at all.