Hello Simen,

BCS <[email protected]> wrote:

The given test as is might be all catchable but add loops and
references  into the picture and I think it turns into the halting
problem.

Would you mind explaining in further detail? I am not really sure what
you mean.


Cow c;
while(someFn()) {
 c = new Cow();
 c.slaughter();
}
c.slaughter(); // invalid Iff the loop ends

Cow c, d, r;
for(int i = 0; someFn(); i++) {
 c = new Cow();
 d = new Cow();
 r = (i%2) ? c : d;
 c.slaughter();
}
r.slaughter(); // invalid Iff the loop ends on an odd i.

void Fn(Cow c, Cow d) {
 c.slaughter();
 d.slaughter(); // invalid Iff called with (c is d).
}


Checking that the sequence of member function calls on an object is valid is limited by how good your static analysts is. The type system *can't* help you as the exact same code may or may not be valid depending on arbitrary external aspects.

--
... <IXOYE><



Reply via email to