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

The first one is eight tokens, of which at least three are necessary: 100, for, and i; let's say four. The second one is 13 tokens. That means it has more than twice as much noise to distract you from the signal, and to get right when you write the code. As a result, variations like these require more attention to notice when you're reading the code:

    for i = 0; i < 100; i++ { }
    for i := 1; i < 100; i++ { }
    for i := 0; j < 100; i++ { }
    for i := 0; i <= 100; i++ { }
    for i := 0; i++; i < 100 { }
The first has no counterpart in Python (where the 8-token version comes from) since Python always has that bug. The others are:

    for i in range(1, 100):
    i=0; while j < 100: i += 1; ...
    for i in range(101):
    raise TypeError
In short, every bit of extraneous information you put into your code distracts you from the relevant information, and that extraneous information is something else you can get wrong. Golang does a lot better at this than C does, but it could do better still.

In some cases, where Golang is noisier than Python or Ruby, it's because the extra redundancy is there to catch errors or encourage you to handle failures properly. This is not one of those cases.



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

Search: