そこで、関数がオブジェクト自体から呼び出されているかどうかを確認するためのハックのようなものを思いつきました。このようなことをしない正当な理由を誰か教えてもらえますか?
function Poo(){
this.myFunc=function(){
for(x in this)
{
if (this.myFunc.caller==this[x]) {
alert(this.myFunc.caller==this[x]);
return;}
}
alert(false);
}
this.myFunc2=function(){this.myFunc();}
}
var mine=new Poo();
mine.myFunc(); //calling directly not allowed prints false
mine.myFunc2(); //called from a member function allowed prints true