How to ensure one method is executed before executing another?

Please read this post for background.

You have written getLoc as if it were a type B method, but the crucial condition that is italicized is not true. getLoc is really a type C, and if you rewrite it accordingly, your problem will melt away.