Forum Discussion
EnTerr
9 years agoRoku Guru
"TheEndless" wrote:
... but why would a "competent and reasonable developer" think that any component could randomly delete a different component's field observations? I could understand the observee being able to remove multiple observers, but one observer deleting another doesn't make sense to me, especially when you consider that the observers generally aren't aware of each other's existence.
Because
- A "reasonable person" when seeing unqualified "ANY", assumes it means what it says - removes any and all. Does it say "current caller's ..."? (It does not.)
- Components can already peek & poke at each other's Fields - intuitively they could meddle with observer functions too (there is no expectation of privacy)
- Notice you are muddling here the meaning of "observer" - observers are not objects but "pseudo-methods" (functions defined in XML file extending a class). Say observer myClass::f1() was placed over anotherNode.FieldFoo. It is not such observer myClass::f1() that deletes itself - rather it could be (and likely is) another, unrelated function myClass::g2() that calls anotherNode.unobserveField() to remove "any" observer functions.
- And what if (a function from) anotherNode wants to strip all observers from its very own FieldFoo? That is a business use too! It makes a good case for anotherNode.unobserveField("FieldFoo") being able to shake all "peeping Toms" off its own field.