Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's hard for a naive parser (one-token lookahead, for example), to tell after parsing `const add = (` if this defines a function or a variable.

A "function" keyword often exists just to help the parser. C3, for example, to simply the parser of its language that's a superset of C, adds a "fn" keyword for this very purpose of disambiguation.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: