Hacker News new | comments | show | ask | jobs | submit login

This is an important point, and I'm glad I can expand a bit on it here.

Considered as purely a syntactic issue there's not much for discussion. Fix the parser. But! Conceding that method/function application is useful along side the invocation operator `()` (which it certainly seems to be) makes this an interesting semantic issue. That is can two terms mean different things but look "similar"

I have no interest in telling anyone how to build a programming language or that one approach is subjectively "wrong", but knowing that certain term pairs in a language could be ambiguous with respect to each other seems like valuable information. Provided to the creator at the right time it might help with language design.

Eh? This is where I don't follow. What exactly are you recommending should be changed when you say "fix the parser"? Choose the other disambiguation, or simply use an entirely different function literal in the first place?

For what it's worth, this particular ambiguity was discussed as part of the original language design. It was decided that having parentheses for both argument definitions and argument application was useful parallelism, and that function literals shouldn't have to have a "def", "func", "function", or other prefix. From those two ideas:

    # Definition
    (input) -> output

    # Application
... the rest of it falls out naturally.

s/fix the parser/change the parser/, meaning choose not to support both types of invocation.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact