Cannot assign to vector returned by map()


#1

I’m using Chaiscript 5.7.1. The following works as expected.

var x = [1, 2, 3];
x[0] = 2;  // x is now [2, 2, 3]

However, the following code, which creates a vector by using map(),

var v = [1, 2, 3];
var y = map(v, fun(s) { s*2; });
y[0] = 1;

does not work and give the error:

Error: "Error with unsupported arithmetic assignment operation" during evaluation at (1, 1)

I checked y and y[0], neither are constant.


#2

I have confirmed that this issue exists on 5.7.1 but has been resolved on develop already.

-Jason