[m-rev.] for review: fix problems with array.shrink/3
Julien Fischer
jfischer at opturion.com
Mon Nov 12 12:15:39 AEDT 2018
Hi Peter,
On Mon, 12 Nov 2018, Peter Wang wrote:
> On Thu, 8 Nov 2018 13:56:09 +0000 (UTC), Julien Fischer <jfischer at opturion.com> wrote:
>>
>> For review by anyone.
>>
>> This fixes the issue marked JJJ in my previous commit.
>>
>> --------------------------
>>
>> Fix problems with array.shrink/3.
>>
>> The behaviour of array.shrink/3 was not defined if its first argument was
>> negative. If this occurred, the C backends would return an empty array, while
>> the non-C backends would abort. This diff changes the behaviour of shrink/3 so
>> that it throws an exception if its first argument is negative.
>
> Please make a similar change for array.resize, in a separate change if
> you like.
Already done ;-) I just haven't posted the diff yet.
> The diff looks fine.
Thanks for that.
I had a bit of look through the stdlib for things that take an integer
argument indicating a size or count. There are a few other predicates
that are problematic, for example list.duplicate will return an empty
list for a negative value. IMO, it should throw an exception in that
case, but whichever behaviour it has needs to be documented.
Julien.
More information about the reviews
mailing list