title: Template String As Object Property Name
body: <p>Why does JavaScript not allow a template string as an object property key? For example, when I input:</p>
  
  <pre><code>foo = {`bar`: 'baz'}
  </code></pre>
  
  <p>into the NodeJS REPL, it throws a <code>SyntaxError</code> with "Unexpected template string" with a long stack trace. Property values are fine, however, which is not as unexpected. Similar errors happen in the browser, for example, Firebug throws a <code>SyntaxError</code> with "invalid property id".</p>
  
  <p>Template strings are allowed in "computed property names". For instance, this compiles perfectly fine in all browsers that support the syntax:</p>
  
  <pre><code>var foo = {
      [`bar` + 1]: `baz`
  };
  </code></pre>
  
  <p>and creates the object <code>{"bar1": "baz"}</code>.</p>
  
  <p><strong>Why are template strings not allowed as literal object keys?</strong> Is it for performance reasons? Template strings must be compiled, possibly at runtime (correct me if I'm wrong), which means every time it encounters this object, the interpreter will have to compute the object name. Factoring in things like "cooked" template strings, this seems like it could get slow, although we have had getters and setters since ES5. Firefox does not mention this as an error, which is why I found it unexpected. Will the syntax be allowed sometime in the future?</p>