Bug in vector operations
stefandd opened this issue · comments
let x = xyz_i{1, 0, 0}
print 3 * x // x * 3 works
produces the erro .lobster(2): error: can't use "*" on "int" and "xyz_i"
That's an intentional limitation that should probably be documented for the moment. It was there to not explode the number of VM vector operations. Though I guess it just needs extra versions of -
, /
and %
, the rest can be swapped. Should eventually be made possible, of course.
I don't think you'd need extra operators for /
or %
because either would be ill-defined if the number was the left operand! I think you'd only need an extra version of the -
then.
Why? 4 / xy { 2, 1 }
could result in xy { 2, 4 }
, no different from -
. The other way around is just more natural to read, since you start with a vector already.
This is fixed, nowadays scalar op vector
works