Hey, i really like how languages like Odin support Vector Math, i mean having Math Operator to Update Array Indizes. I don't know if it fits Roc but i just wanted to throw out the idea.
There have been quiet a lot of discussions about it. Here is the most recent topic on it #ideas > static dispatch - operator desugaring to methods . Roc's historically been reserved to add operator overloading so that + would work on your custom matrix types, because it's easy to misuse that feature. But we all agree that it is nice for matrices, so (according to the plan) defining a plus function on a custom type will allow such thing. It's just that the type will have to be nominal (have to be declared with a name in a separate module, not created on a whim out of literals)
Also, what @Norbert Hajagos would work for adding custom matrices, but without indexing syntax. E.g. even without custom data structures, there's no such thing is list[index] in Roc
@Jonas could you give an example of what you'd want to be able to do? I presume list[index] += 3 is what you mean
Ahh yes, no vec[idx] operator, since List is the base "array-like" collection, which isn't fix sized and there's always a bounds check, so it returns a result. We have no arrays, only tuples, but they are more like structs.
@Sam Mohr yes
Also, roc has no support for missing types. So no matrix plus scalar. I guess we could add it with static dispatch, but that is a separate idea
Last updated: Jun 16 2026 at 16:19 UTC