Since you directly indexing with array you get a temporary Array for v[pixmap] in rhs so it is adding 1 to 1 10 times and stores at location 1. You need to use views to affect both sides of the assignment.
I do not think using views would resolve the issue as broadcasting will do unaliasing and the result would be the same. Could you post what you exactly meant? Thank you!
When I use @views @. v[pixmap] += 1. I get 10 as expected for this case but you are right there are cases where there is alias check but not for this one though.
Thinking about this some more, the semantics I am really after is something between map() and mapreduce(), like “mapsemireduce()”. That is, consider an array of size n. Then, map() maps this array onto an array of the same size, and mapreduce() maps it onto an array of size 1, and mapsemireduce() would map it to an array of size m<n. Really, it is mapreduce() on subarrays. I don’t suppose such a programming paradigm already exists?