Many useful finite generators will not know their length ahead of time, so
this would be a poor way to detect finiteness.

Infinite generators will always create many hazards of non-termination if
provided to contexts expecting finite generators. Similarly looped data
structures, if provided to contexts expecting acyclic data structures. For
the latter, at least it can be detected (as JSON.stringify does).

While we could try to create nominal subtypes FiniteIterator and
InfiniteIterator so that iterators can declare their alleged intent, IMO
this is overengineering for a rare case. And provides no guarantees anyway.
I think we should just live with the non-termination danger. We've been
doing so for all other sources of non-termination since Turing ;).


On Wed, Feb 15, 2012 at 7:48 AM, Dean Landolt <d...@deanlandolt.com> wrote:

>
>
> On Tue, Feb 14, 2012 at 11:49 PM, Brendan Eich <bren...@mozilla.org>wrote:
>
>> +1 on ... (spread) exhausting an iterator to expand the iterated values
>> into positional parameters or initialisers.
>>
>
> What about infinite generators? Punt on any iterators without a predefined
> length? Otherwise wouldn't there be some kind of exception akin to a stack
> overflow?
>



-- 
    Cheers,
    --MarkM
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to