Allen Wirfs-Brock (2014-03-08T23:43:06.000Z)
On Mar 8, 2014, at 11:05 AM, Mark S. Miller wrote:

> 
> 
> [1] A more correct expansion is:
> 
>   var whatsThis = func(
>     Object.freeze({
>       raw:    Object.freeze(['', ' + ', '\\n = ', '']),
>       cooked: Object.freeze(['', ' + ', '\n = ', ''])
>     }),
>     x,
>     y,
>     x + y
>   );
> 
> except that the record is evaluated once per evaluation of the enclosing Program (loading of the compilation unit), rather than per evaluation of the expression. This allows func to memoize template-string-parsings on the identity of the record.

Actually, more like:

  var whatsThis = func(
    Object.freeze(
      Object.defineOwnProperty(['', ' + ', '\n = ', ''],'raw', {value: Object.freeze(['', ' + ', '\\n = ', ''])}
    ),
    x,
    y,
    x + y
  );


As the "cooked" array itself is now specified as the call site object. See http://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-runtime-semantics-argumentlistevaluation 

I'll add a note about possible future properties.  Also,  current spec. says the raw property is enumberable.  That sounds like a bug I'll fix. (don't want "raw" showing up if somebody for-in enumerates the call-site object.

Allen

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140308/11fbe25d/attachment.html>
domenic at domenicdenicola.com (2014-03-20T16:29:35.005Z)
On Mar 8, 2014, at 11:05 AM, Mark S. Miller wrote:

> [1] A more correct expansion is:
> ...

Actually, more like:

```js
  var whatsThis = func(
    Object.freeze(
      Object.defineOwnProperty(['', ' + ', '\n = ', ''],'raw', {value: Object.freeze(['', ' + ', '\\n = ', ''])}
    ),
    x,
    y,
    x + y
  );
```

As the "cooked" array itself is now specified as the call site object. See http://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-runtime-semantics-argumentlistevaluation 

I'll add a note about possible future properties.  Also,  current spec. says the raw property is enumberable.  That sounds like a bug I'll fix. (don't want "raw" showing up if somebody for-in enumerates the call-site object.