a = [1];
b = a.asArray.add(2);
c = a.asArray.add(3);
I think you’ll get [1, 2, 3] here because asArray doesn’t create a new array from an array.
But:
a = 1;
b = a.asArray.add(2);
c = a.asArray.add(3);
Now b will be [1, 2] and c will be [1, 3] because asArray, when called on something that isn’t an array, returns a new array. So b and c end up being separate new arrays.
A Routine is just its own routine (and in fact, Routines can’t be copied). But fork creates a new routine from a function, and it doesn’t have access to any other routines that had been created previously. So they must be separate routines with independent states.