javascript:alert([].sort.call(null)) == [object window] の謎
あ、58ページに書いてあった。If the function code is strict code, set the ThisBinding to thisArg.
2010-02-17 16:42:00@edvakf そっちはcallでthisを明示してない場合です。良くある無名関数の実行などではthisはglobal objectになります。で、ここがstrictモードではnullです。
2010-02-17 16:42:41call したときはまだ thisArg が null のまま (これは ES3 から変更) だけど、entering function code で strict mode じゃなければ null を global にしろと書いてある。
2010-02-17 16:43:35strict mode なら thisArg をそのまま (global にしたり ToObject したりせずに) ThisBinding すると。
2010-02-17 16:45:31javascript:alert(function(){return this}.call()) は normal mode では window で strict mode だと undefined
2010-02-17 16:46:34@edvakf Function.prototype.callを使っている場合、normal modeでもundefinedになるのでは?
2010-02-17 16:48:51いや、明示してなければならないか。function(){return this}.call()とfunction(){return this}.call(undefined)で違いがでるのかな。うーん。
2010-02-17 16:51:00@os0x 58ページの下のリストを見ていくと、strict なら thisArg をそのまま ThisBinding にして、そうじゃなければ、と続きます。なので normal mode では互換性が保たれます。
2010-02-17 16:53:49http://webreflection.blogspot.com/2009/10/es5-and-function-default-scope.html 結局この件に関しては良い解決法は無いんだろうか。
2010-02-17 16:56:08@edvakf なるほど、15.3.4.4 Function.prototype.callが呼ぶ13.2.1 [[Call]]のなかで、thisは10.4.3見ろとあるので、そうなりそうです。
2010-02-17 17:10:08