[m-rev.] Improved array error messages

Peter Ross peter.ross at miscrit.be
Wed Jan 16 11:52:42 AEDT 2002


Ralph wrote:
> +
> +    % out_of_bounds_error(OpName, Array, Index) = IndexOutOfBounds.
> +    %
> +:- func out_of_bounds_error(string, array(T), int) = index_out_of_bounds.
> +
> +out_of_bounds_error(Op, A, I) =
> +    index_out_of_bounds(
> +        string__format("%s: array bounds [%d, %d], index %d",
> +        [s(Op), i(array__min(A)), i(array__max(A)), i(I)])
>      ).
>
I suggest printing out the type of the array which is similar to what is
done for map lookup failures.

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list