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

While I agree with the sentiment, I have two points:

1) The goal of a programming language is to be as unambiguous as possible. This is why we have syntax, and do not program in english. As soon as you use the same token identifier for two purposes, you introduce ambiguity.

Take markdown, for example:

    * Hello *world*
In this line of code, which asterisk should be considered a bullet, and which an indication of emphasis? It seems obvious to a human, but codifying it in a set of rules for a computer is another matter, which introduces complexity and future bugs. (Eg., what do you do in this situation: `* Hello* world`. As somebody who is writing a full formal lexer for markdown, I can tell you first hand that it's an extremely annoying part of the specification.)

Lisp does not have this problem, because it is governed by an extremely simple and effective set of rules:

- An identifier can contain most unambiguous special characters, including - ! ? / + < > = etc.

- There are no operators, only functions.

- A hyphen by itself is a perfectly valid identifier.

- The standard library includes a function named hyphen which performs a subtraction operation.

Taking that into consideration, it makes the entire situation completely ambiguous. `a-b` is one identifier. `a - b` and `- a b` are both a string of meaningless identifiers. `(a - b)` performs function `a` with arguments `-` and `b`, and `(- a b)` performs function `-` with `a` and `b`.

Ruby is actually interesting in that it is one of the few languages which, like lisp, does not have operators. You could remove ambiguity by doing `a.-(b)`. However, readability immediately goes out of the window. Much more so than in lisp's case. Consider this:

    (4.*(5)).+((7.*(9))./(3)).+(1) #<= the meaning of life
It's semantically a perfectly valid expression, but how long did it take you to mentally evaluate it to 42? Compare with:

    4*5 + 7*9/3 + 1
2) If you're going to be writing an article about it, please learn the right terminology. - is a hyphen. Dashes are – (en-dash) and — (em-dash). Hyphens separate contracted words. En-dashes indicate a range. Em-dashes indicate a aside, much like a parenthesis.


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

Search: