Set constructor arguments

Mark S. Miller erights at google.com
Wed Feb 15 09:13:01 PST 2012


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 <dean at deanlandolt.com> wrote:

>
>
> On Tue, Feb 14, 2012 at 11:49 PM, Brendan Eich <brendan at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120215/8d0fee6a/attachment.html>


More information about the es-discuss mailing list