This proposal is to match de-facto usage in some CLI JS hosts that allow for Shebangs / Hashbang. Such hosts strip the hashbang in order to generate valid JS source texts before passing to JS engines currently. This would unify and standardize how that is done.
#!/usr/bin/env node
// in the Script Goal
'use strict';
console.log(1);
#!/usr/bin/env node
// in the Module Goal
export {};
console.log(1);
- Stage: 3
- Tests
- Spec PR: TODO
- Implementations shipping:
- Chrome Canary 74
- Firefox Nightly 67
Hash is commonly associated with modern terms involving #
such as hashtag. In addition for discoverability, the term "hash sign" is used for #
but "she sign" is not.
Hashbang directives are only valid at the start of a file for interpretters in various CLI environments. There is no gain for the intended usage by allowing it in other places and in fact could lead to confusion since it would not be picked up by CLI environments. Additionally by allowing Hashbang in other places it overlaps a grammar space for #!
if it is an inifix binary expression of some kind. Use //
if you want line comments elsewhere.