Set constructor arguments

Dean Landolt dean at deanlandolt.com
Wed Feb 15 12:19:14 PST 2012


On Wed, Feb 15, 2012 at 12:13 PM, Mark S. Miller <erights at google.com> 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 <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/747486d7/attachment.html>


More information about the es-discuss mailing list