another rivertrail question

# Norm Rubin (12 years ago)

In an elemental function does throwing an error, count as a side effect?

For instance

V2 = new Array(10, function(){return 23} ,14)

V1 = ParallelArray(14,12,10)

V1.map( function(e,i) { var temp = array[e-12] = v2[i].toFixed() ; ... })

Since the toFixed will throw a type error when i =1, and a range error when e = 10

If this is a side effect, then it is not an elemental function and should throw Error, not typeError or rangeError


This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.

# Hudson, Rick (12 years ago)

TypeError instanceof Error is true so an implementation is free to throw TypeError.

It does not count as a side effect.

What happens when a kernel throws an exception is not covered in the strawman.

I suggest that an exception coming from within a kernel function will result in an exception being thrown from the high level ParallelArray method. If more than one kernel throws an exception the ParallelArray method is free to choose which one is thrown to its caller.