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 move the stripping to engines, it does unify and standardize how that is done.
// in the Script Goal
// in the Module Goal
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 comments 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.
A byte-order mark (BOM) character at the beginning of a source text will prevent a subsequent
#! from being interpreted as a hashbang. However, web browsers strip this character as part of fetching external scripts or modules (in
UTF-8 decode respectively), which happens before the text is interpreted as ECMAScript. As such, in browsers a BOM character can precede a
#! in an external script or module, but not an inline one.
Generally speaking, the BOM character is assumed to be handled by the host, and is not given special treatment by this proposal.