3 ms·
Are there dynamically-typed systems that actually do this? That check the units of matrix and vector elements at runtime without checking every single time you
by evanpw 11y ago
Are there dynamically-typed systems that actually do this? That check the units of matrix and vector elements at runtime without checking every single time you want to multiply two numbers together?
- im3w1l 11y agoI imagine most languages with a matrix library uses opaque types implemented in C or similarly fast language. So just one typecheck would need to be done.
- evanpw 11y agoI'm sure they check that the matrix doesn't contain a string, or that you're not mixing 32-bit and 64-bit floats, but checking user-defined units as in the article, where each row or column may have a different one seems almost as hard in a dynamically-typed language, unless you do the check at the very bottom level. And that would be unimaginably slow.
- im3w1l 11y agoOh ok, yeah I refered to 32/64bit floats / ints. I didn't like the notation in the article, so I didn't bother understanding what he was talking about.