Perhaps in some cases weaker, more manageable mechanisms than full-powered observers and listeners could be sufficient.

For example, one approach which gets you the right cleanup behavior without exposing GC, is to have special-case observers which can be easily proven to be safe to drop. For example, suppose we had:

    observerService.addSettingObserver(obj, "dirty", true)

which promises to set obj's 'dirty' property to true. If obj is collected, this observer can obviously be dropped.

I understand that not every use case can be handled this way; it's simply not as powerful as calling a function. But certainly every case that *can* be handled this way should.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to