[erlang-questions] lists:seq/[2,3] bug?

Richard A. O'Keefe ok@REDACTED
Fri Sep 19 05:22:18 CEST 2008


On 19 Sep 2008, at 6:37 am, Nicolas Charpentier wrote:

> Richard A. O'Keefe wrote:
>>> I think that your proposition will break a lot of code.
>> Why do you think that?  The correction I want ONLY affects
>> cases where the current version blows up; whenever the
>> current version returns any answer at all, mine returns the
>> same one.
>
> Hi,
>
> With the current implementation, the process crashes if it calls  
> lists:seq(N,M) with M<N. (A crash means an unexpected)
> With your proposition, the same process will continue to do things  
> but using an empty sequence.

ONLY in the case M = N - 1, and BECAUSE IT MAKES SENSE.
>
> For me, this is a big difference and all running applications must  
> be checked to ensure that they can handle empty sequence correctly.

It is also the case right now that all existing code that uses seq
should be checked to ensure that it DOESN'T expect empty results.
I know what the manual says, but people find it easier to remember
stuff that makes sense, and so it's entirely credible that other
people than me would have test cases
	[F(I) || I <- lists:seq(1, N)]
that fall down dead when N = 0 *but shouldn't*.





More information about the erlang-questions mailing list