# Tensors static typing

**URL:** https://internals.rust-lang.org/t/tensors-static-typing/13114
**Category:** language design
**Created:** [September 22, 2020, 12:18pm UTC](https://internals.rust-lang.org/t/tensors-static-typing/13114 "2020-09-22T12:18:11Z")
**Posts on this page:** 1
**Showing post:** 32

<div class="post-metadata">

### Author: ![sighoya](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@sighoya](https://internals.rust-lang.org/u/sighoya)
#### Post date: [October 28, 2020, 4:07pm UTC](https://internals.rust-lang.org/t/tensors-static-typing/13114/32 "2020-10-28T16:07:19Z")

</div>

> [@jerry73204](#):
>
> Those interested can look at my [typ](https://github.com/jerry73204/typ) to see how it's possible in Rust.

Interesting

> [@jerry73204](#):
>
> How to encode complex logic in types. For example, can we statically compute the dimensions of tensor product of two tensors?

I think that this will be possible someday with const generics, when the logic only involves addition and multiplication.

> [@jerry73204](#):
>
> For the second issue, we could interpolate runtime checkers by dispatching `UTerm + UTerm` and `UTerm + Dyn` into different `impl` blocks, and insert checkers accordingly

I think too, that this will happen someday with const generics but there are other problems incured by const generics and dispatching, see [this thread](https://internals.rust-lang.org/t/future-direction-const-generics-and-dispatching/13283).

---

_[View the full topic](https://internals.rust-lang.org/t/tensors-static-typing/13114)._
