On Wed, Feb 15, 2012 at 12:13 PM, Mark S. Miller <[email protected]> wrote:

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

Yes but you can count the times you've iterated and punt when exceeding
`length`, like a poor man's stack depth hint. But yeah, pretty hacky.


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 ;).
>

True. But this is a little different -- syntactically, spread doesn't
exactly scream "I'm calling an arbitrary, potentially non-terminating
function", but neither do getters. But I'm sure we'll survive.



> On Wed, Feb 15, 2012 at 7:48 AM, Dean Landolt <[email protected]>wrote:
>
>>
>>
>> On Tue, Feb 14, 2012 at 11:49 PM, Brendan Eich <[email protected]>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
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to