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

Spell out stack hiding in more detail / maybe align with built-ins #22

Closed domenic closed 4 years ago

domenic commented 5 years ago

In today's TC39 it became clear we need more details about the intention of this proposal with regard to hiding of stack frames. Although this will be tricky to specify given that the spec has no notion of stack frames, and tc39/proposal-error-stacks doesn't help (since it only specifies a format and not the contents), we need to at least be clearer in the proposal.

In particular, it was noted that the idea of completely omitting the stack frames does not match the way in which built-in functions are implementation-hidden by today's browsers. For example, check https://jsbin.com/celomim/edit?html,console,output , which does x.map(Number). Note that:

My personal preference would be to align with the same sort of strategy browser-built-ins use. But, I haven't thought through how to specify that in detail, or whether it meets the encapsulation needs---especially for @michaelficarra's use cases.

One big TODO here is we want to incorporate @michaelficarra's presentation's examples about secret-disclosure into the README, to make it easier to validate and reason about proposal tweaks which might impact those.

ljharb commented 5 years ago

It's worth calling out explicitly that this can hide frames from the top level of a Module as well (and presumably from a Script?)

domenic commented 5 years ago

It's worth calling out explicitly that this can hide frames from the top level of a Module as well (and presumably from a Script?)

It's a good question whether it would do that. I wasn't consciously aware that such frames existed, but of course they do.

michaelficarra commented 5 years ago

I forgot about this issue when I created #23 with my thoughts on the topic. I'll just cross-reference for now, and we can close one or the other as duplicate later.

michaelficarra commented 4 years ago

This has been resolved. The new capabilities we want to give developers are

Conveniences for the following were rejected