#947: Early review request for "Explicit JavaScript Compile Hints"
Discussions
Log in to see TAG-private discussions.
Discussed
Nov 11, 2024 (See Github)
Dan: Agree with Jeffrey this isn't in our wheelhouse. Although he commented that "in HTML and CSS we don't use comments, we use attributes or properties, and the equivalent in JS might be decorators."
Yves: decorators should be the way to go, especially with minifiers
Dan: should we be pushing back on this?
Yves: it doesn't look great but might be better for TC39..
Dan: but if it's to do with browsers?
Yves: it's not only limited to browsers, any server or js engine
Matthew: in what situation would you have a load of functions and not know if they were going to be needed?
Yves: if you were using a whole library, but in that case you can't decorate it or add comments
Matthew: agree if you were writing a library not all of it is necessarily goin to be used, but if it's something running in a browser or server there's some end program there and surely there wouldn't be some functions in it that it wouldn't necessarily need. If it depends what input the user gives and it could need them then it needs them and they should be there... how would you get in that situation? If you think about the libraries your code is calling you can use things like rollup and treeshake to strip out the bits you know you don't need. I'm used to the idea of stripping out bits that you know you don't need, where this is philosophically the opposite saying things might be needed. How would you expect the browser to behave differently?
Yves: especially you need to parse it to know if you need to parse it or not..
Matthew: genuinely interested in the use case...
In general, the TAG is skeptical of introducing a pattern which introduces semantics in comments, it would be more useful to use decorators or another pattern that cannot be stripped. It seems like this is more general than just browsers, so we feel this probably should be a topic for TC39. We're going to close this for now and we encourage you to bring this to TC39 and come back to us.
Comment by @torgo Nov 13, 2024 (See Github)
In general, the TAG is skeptical of introducing a pattern which introduces semantics in comments. It would be more useful to use decorators or another pattern that cannot be stripped. It seems like this is more general than just browsers, so we feel this probably should be a topic for TC39. We're going to close this for now and we encourage you to bring this to TC39 and come back to us.
OpenedApr 22, 2024
こんにちは TAG-さん!
I'm requesting a TAG review of "Explicit JavaScript Compile Hints".
This proposal introduces a new magic comment that signals to browsers that the functions in a JavaScript file are likely to be needed by the website. This allows the browser to parse and compile them eagerly, which can improve page load times.
Further details:
Thanks in advance!