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

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to