You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, broadcast! into BitArray caches some results and only writes them back later. If the function that is broadcast happens to throw, then we leave the destination in an undefined state.
I think this is fine, and we should decide and document that map!, broadcast!, etc leave the destination with undefined contents if the mapped / broadcast function happens to throw. If we tried to make any guarantees we would prevent a lot of possible optimizations (e.g. hypothetical future multi-threaded implementations, caching without exception handlers, etc).
The text was updated successfully, but these errors were encountered:
Agreed. We're already doing this with BitArrays and other packages are taking it even further with GPU kernels and such. We do need to document it, though, and I agree we should go beyond errors: side-effects will happen, but their order is not guaranteed. A good example of this behavior is:
A .=rand.()
That should initialize all elements of A to be drawn from a random distribution, but the order in which they pull from the RNG is arbitrary.
Currently,
broadcast!
intoBitArray
caches some results and only writes them back later. If the function that is broadcast happens to throw, then we leave the destination in an undefined state.I think this is fine, and we should decide and document that
map!
,broadcast!
, etc leave the destination with undefined contents if the mapped / broadcast function happens to throw. If we tried to make any guarantees we would prevent a lot of possible optimizations (e.g. hypothetical future multi-threaded implementations, caching without exception handlers, etc).The text was updated successfully, but these errors were encountered: