Re: set_weak_flag() for objects?

"Stephen R. van den Berg" <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
Tried some more, not even the workarounds work as expected:

class NoRef {
  void create() {
    werror("Created NoRef\n");
  }

  void destroy() {
    werror("Destructed NoRef\n");
  }
}

class Ref {
  private mixed id;

  void create() {
    id = this;
    werror("Created Ref\n");
  }

  void destroy() {
    werror("Destructed Ref\n");
  }
}

class WRef {
  private array id;

  void create() {
    id = ({0});
    set_weak_flag(id, Pike.WEAK);
    id[0] = this;
    set_weak_flag(id, Pike.WEAK);
    werror("Created WRef %O\n", get_weak_flag(id));
  }

  void destroy() {
    werror("Destructed WRef\n");
  }
}

int main(int argc, array(string) argv) { 
  object a;
  a = WRef(); a = 0;
  a = NoRef(); a = 0;
  a = Ref(); a = 0;
  werror("Finished\n");
  return 0;
}

Any ideas?
-- 
Stephen.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.