Object Keys are string. What is used in x[a] is in fact x[a.toString()].
This means that your function as key is exactly the same key as a string :
x[a] === x["function () { return 'a' }"]
So yes, you might consider it both unsafe and unreasonable. It's hard to imagine a context in which it would be useful or efficient.