That hash symbol

Brendan Eich brendan at mozilla.com
Sun Mar 27 13:11:41 PDT 2011


As covered with Jeff Walden, I misread your `` usage as meta not concrete. And those quote characters are wanted for quasis, and anyway not function-y in any language I know of. Mike Samuel's latest shows they aren't strictly necessary.

Rather than sketch what might look pretty or easy to type and see if it can be made to parse, we could do better by considering nearby languages. In the https://gist.github.com/888867#comments I ask whether we skirt the bottom-up parsing cliff one more time, and consider

       -> {/* no formals */}
 ()    -> {/* no formals */}
 a     -> {/* one formal */}
 (a,b) -> {/* two formals */}

 ([d,e],f) -> {/* two formals, first destructures via array pattern */}

These are not all necessary. CoffeeScript supports the first, C# the third, IIRC. The body could be an expression in parentheses (if not of high precedence). Details TBD. But this would get away from the "pick a funny prefix punctuator or symbol" game.

The parsing may be something we can finesse in a top-down parser, by parsing the covering RHS equivalent and then walking the AST to validate that it is a well-formed parameter list.

In no case is anything like quoting required, or IMHO a good idea.

/be


More information about the es-discuss mailing list