Well, it is possible to do, and even with almost zero overhead. If you really want, I can create a PoC using kmath structures in a separate module. I am still not convinced that this feature is really needed, but it could be done without breaking anything.
b
breandan
06/21/2019, 6:22 AM
I really want this feature... there's a toy implementation I've been playing around with here: https://github.com/breandan/kotlingrad/blob/master/src/main/kotlin/edu/umontreal/kotlingrad/dependent/MatDemo.kt
The idea is that if the user provide a type, it should be easy to check/infer the result type of most matrix operations at compile time. And it's completely optional, so if it's the shape is not specified, then it defaults to dynamic construction with a runtime exception on incompatible shapes.
breandan
06/21/2019, 6:24 AM
It would be nice if Kotlin had real type level integers, but they can be enumerated up to a fixed constant like this does: https://github.com/paholg/typenum
a
altavir
06/21/2019, 6:24 AM
OK, I have a bit of free time today, I will try to draw a PoC and get back to you. The type-safe functionality will be added as a thin layer on top of existing ndstrucures.
altavir
06/21/2019, 6:24 AM
If it works, you can then add a functionality from your project