Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should "show source" be part of this proposal? #42

Open
tmikov opened this issue Dec 5, 2019 · 6 comments
Open

Should "show source" be part of this proposal? #42

tmikov opened this issue Dec 5, 2019 · 6 comments

Comments

@tmikov
Copy link

tmikov commented Dec 5, 2019

Hermes (and probably Moddable, QuickJS, etc?) doesn't preserve the source by default since everything is compiled to bytecode in advance. In other words "hide source" is the default. It seems that such implementations are becoming more widespread recently.

So, in Hermes we are planning to add a "show source" (or "preserve source", etc) directive for the few cases where the source must be available at runtime.

The question is, does it make sense to consider adding it to this proposal, since it is technically relevant?

@tmikov
Copy link
Author

tmikov commented Dec 5, 2019

I did, but I don't think it fully addresses this use case. In several implementations like Hermes the source is simply not available by default. At the same time, there are legitimate situations where the source of a selected few functions is needed at runtime.

So, implementations have to come up with custom and potentially differing solutions for this. That is fine, or perhaps a new and separate proposal is the best way to address this. But given how closely related it would to the this current proposal, I thought it makes sense to bring it up. In some sense it would be strange to have one proposal adding "hide source" and a second one adding "show source" :-)

@tmikov
Copy link
Author

tmikov commented Dec 6, 2019

To be clear, I am not insisting that this be included, but I feel that it is a more common use case than is commonly assumed, so I am just testing the water what people think. As I understand it, since we are not at stage 3 yet, this is the last opportunity to do it.

@michaelficarra
Copy link
Member

@tmikov Implementations are allowed to have their own implementation-defined directives. Hemes can add such a directive, as long as it is not in violation of the spec (not that they care about conformance, apparently). So, for example, they could have a "show source" directive that would preserve the source text except where it would otherwise be explicitly hidden using "hide source".

@tmikov
Copy link
Author

tmikov commented Dec 6, 2019

@michaelficarra for the record, we do care about conformance a lot. That is precisely why I am filing this question and why we are attending TC39 meetings. My point is that there are currently multiple engines running from bytecode with this same issue and they seem to be gaining popularity outside of web. However the use case may not be as visible to people focusing on web or they may (incorrectly) assume that those engine don't care about spec conformance.

I think it would be a disappointing if every such engine implemented a different solution to this when we have a chance to unify it.

@linonetwo
Copy link

I'm using 'show source'

Related facebook/hermes#114 (comment)

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

No branches or pull requests

3 participants