tc39 / proposal-function-implementation-hiding

JavaScript language proposal: function implementation hiding
https://ci.tc39.es/preview/tc39/ecma262/pull/1739
MIT License
98 stars 7 forks source link

should non-simple parameter lists be allowed to mix with these new directives? #45

Open michaelficarra opened 4 years ago

michaelficarra commented 4 years ago

We disallow the "use strict" directive in functions with non-simple parameter lists because it complicates the parsing of the parameter list. While the directives introduced by this proposal do not affect parsing, they do affect "earlier" code, e.g. functions defined in the parameter list. Is that a significant enough inconvenience for implementers that we want to disallow the commingling of these two features?

/cc @bakkot who raised this question

ljharb commented 4 years ago

It seems reasonable to apply the same restriction for the same reasons.

michaelficarra commented 4 years ago

@ljharb It's not quite the same reasons though. An implementation wouldn't have to re-parse the parameter list, they would just need to track the functions that they parsed in the parameter list until they've passed the directive prologue. This is a significantly smaller implementation burden.