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

Motivation for pragma? #4

Closed littledan closed 5 years ago

littledan commented 6 years ago

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.

domenic commented 6 years ago

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.

littledan commented 6 years ago

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.

domenic commented 6 years ago

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.

littledan commented 6 years ago

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.

domenic commented 5 years ago

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.