isInfinite isInadequate

monarch_dodra monarchdodra at gmail.com
Wed Oct 17 05:52:40 PDT 2012


On Wednesday, 17 October 2012 at 12:45:07 UTC, Peter Alexander 
wrote:
> On Wednesday, 17 October 2012 at 12:33:54 UTC, monarch_dodra 
> wrote:
>> Technically, cycle([]) *is* isInfinite, but the program will 
>> assert because of a run-time error due to the user's logic. 
>> Nobody said that just because a range is infinite, that it 
>> can't ever fail...
>
> cycle([]) is not infinite. A infinitely repeated empty range is 
> the empty range.

I'd argue that cycle should be redefined as "Repeats the 
*content* of the given forward range ad infinitum." From there, 
passing it an empty range would be a logic error, since said 
range didn't have any content.





More information about the Digitalmars-d mailing list