Immediate closing of iterators

Chris Hansen renselp at gmail.com
Thu Dec 21 09:55:23 PST 2006


> You're right, the case 2 analysis I wrote up in my last message was
> too restrictive.  If you put a type annotation on function gen, then
> the guarantee should hold:
>
> class CollectionWrapper {
>   var collection = ...some collection...;
>   function gen():Generator.<*,*,*> {
>     return this.collection.gen();
>   }
> }

But if the rule is less restrictive I would claim that my original
objection applies: you need to run a full gc whenever a loop exits
abruptly to determine whether or not the generator is reachable:

class CollectionWrapper {
  var collection = ...some collection...;
  function gen():Generator.<*,*,*> {
    var result = this.collection.gen();
    if (someCondition) myGlobal = result;
    return result;
  }
}


-- Chris



More information about the Es4-discuss mailing list