4 ms·
Is the hash symbol the best? It already is used within classes to mean private. Syntactically for the machine parser, I assume it will work just fine for these
by combatentropy 6y ago
Is the hash symbol the best? It already is used within classes to mean private. Syntactically for the machine parser, I assume it will work just fine for these other things. But semantically for my human brain, it is mildly incongruous. If for no reason but elegance and developer delight, I ask for a reconsideration of other punctuation.
- WorldMaker 6y agoSeems like a lot of options were/are debated: https://github.com/tc39/proposal-record-tuple/issues/10 https://github.com/tc39/proposal-record-tuple/issues/10 The benefit to #{}/#[] is that # is not an existing identifier character (other than private fields) in JS, and also isn't an existing binary operator. Proposals to TC39 are constrained that they must as much as possible not "break" existing JS parsing of existing code. That removes a lot of possible characters because they already have valid parses. It also makes it tough to introduce new keywords beyond those ES3/ES5 set in stone as reserved, because they might be identifier names in user applications.
- hinkley 6y agoand it means a javascript CLI file if it's in the first byte of the file... I'm wondering if {{}} is syntactically unambiguous. It's closer to the correct symbols at least. Or maybe there's a parallel to symbols (Ruby, Elixir, ?), and you could leverage a leading colon: let myRecord = :{ foo: "bar" }; but a little tricky with ternaries.