gerry++
gerry++
gerry++
gerry++
JS の Function#toString の表現
そういやなんとなく不思議だと思っていたことがあって、 native コードを持つ Function オブジェクトの toString() メソッドを呼んだ結果の表現は、例えば Chrome だと
"".toString.toString() //=> "function toString() { [native code] }"になるけど、ECMAScript 3rd Edition だと
An implementation-dependent representation of the function is returned. This representation has the syntax of a FunctionDeclaration.
とか書いてあって、実装依存とはいえ、FunctionDeclaration の形式にはなっているようにと読める。けど native コードの場合、雰囲気的に FunctionDeclaration っぽい感じではあっても、"[native code]" の部分は Statement として正しくないので、全体として FunctionDeclaration にはなってない (仕様として正しいの?)。
というかそもそも native コードを持つ Function オブジェクトの toString() メソッドを呼んだ結果の表現について仕様で明言されているのかを知りたかったんだけど、どっかに書いてあるのかな
gerry++
gerry++
gerry++
gerry++
腹痛で起きてトイレにかけこむ