Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

toString should specify if and when the function name is included #6

Closed
ajklein opened this issue Feb 17, 2016 · 2 comments
Closed

Comments

@ajklein
Copy link

ajklein commented Feb 17, 2016

I see the following NOTE at the bottom of the new spec:

"NOTE 2: Do we preserve function name? If so, do unnamed FDs and CDs in export default position cause problems here?"

I think the spec needs to specify this, since the presence (or lack) of function names has semantic meaning. Consider:

var x = function() { x = 42 };
eval(`(${x})`)() // does this assign to the outer x, or silently fail?

Similarly, for named expressions, including the name is important in case the function wishes to recurse.

@michaelficarra
Copy link
Member

This spec is now completely outdated as of the last meeting. I will be entirely rewriting it (again) to reflect the committee's new wishes, which are to preserve a slice of source text from the beginning of the first token of the appropriate structure to the end of the last token. This should address your concern about function names. If so, please close.

edit: Resolution in TC39 meeting notes: https://github.com/tc39/tc39-notes/blob/master/es7/2016-01/2016-01-28.md#conclusionresolution

@ajklein
Copy link
Author

ajklein commented Feb 17, 2016

Ah, thanks for the pointer, that indeed takes care of my concerns.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants