tc39 / proposal-function-implementation-hiding

JavaScript language proposal: function implementation hiding

Home Page:https://ci.tc39.es/preview/tc39/ecma262/pull/1739

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Motivation for pragma?

littledan opened this issue · comments

In the earlier version of the explainer and the previous TC39 meeting, there are pros and cons discussed for in-band and out-of-band Function.prototype.toString censorship. All I see in the explainer is,

The out-of-band censorship solution would be implemented by the host environment, using the HostHasSourceTextAvailable hook. See previous revisions of this document for more information on that; we do not consider it further here.

It would be helpful to document the motivation in more detail.

What do you find confusing? There is already a mechanism in the spec for out or band censorship. This proposal is for adding a mechanism for in-band.

I'm wondering why, given that this mechanism exists, you've decided to add this pragma. I am also wondering whether you are working to support the other mechanism in embedding environments like HTTP/HTML, or think the pragma will be sufficient.

As explained in the bullet points preceding the quoted paragraph, the out of band mechanism is helpful in some scenarios, and the in-band mechanism in others. The idea is indeed to pursue both, but only the in-band mechanism needs an ECMAScript proposal.

OK, I didn't understand that you're actually planning on pursuing both. I think it'd be helpful to add a cross-reference to the HTTP effort.

There's no current work on the HTTP header effort, largely due to (browser) implementers stating that it would not actually provide benefits due to needing to keep the memory for lazy compilation. I'll expand the readme to explain that in a bit more detail, although I'll probably move it around to avoid distracting from the existing proposal.