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

Actually Go's use of := is almost anti-pascal: it means something rather different, but similar enough to be confusing, and so is likely to confuse anybody who's used to the vastly more common meaning of := in Algol-family languages (Pascal, Ada, etc).

... and then there's Go's screwed up version of Pascal-style declaration syntax...

[a link to my earlier rant on this subject: http://news.ycombinator.com/item?id=4520104 (TL;DR: Go: "var foo, bar int"; Pascal: "var foo, bar : int"; the colon vastly improves readability, and has no real drawback)]



> the colon vastly improves readability

We have gofmt for that :)


> > the colon vastly improves readability

> We have gofmt for that :)

Er, what? gofmt doesn't improve the readability of declarations at all... [there's really not much it can do]


It spaces them evenly if you have multiple subsequent lines of them. Readable enough:

    var (
        i, j        int
        foobarStuff string
        bebop       bool
    )
What's not readable?


Er, ok, it can slightly mitigate the problem in a few cases. Even to the extent that it work though, this is a very fragile "solution" — (1) declarations often occur alone, (2) multiple declarations can have similarly sized variables, meaning there's no big whitespace chunk to act as a separator, and (3) one shouldn't have to run one's code through a code formatter, or use awkward formatting practices, to get basic readability....

Simply following standard practice (over decades), and including a colon, on the other hand, would have made all declarations more readable, and be more familiar, for no real cost.

Really, some of Go's syntax decisions are completely baffling...

[Sure there are lots of crazy computer languages around, but these guys really should have known better—and anything they do is much more likely to have an impact than most random languages, so it'd be nice if they could take a bit more care...]




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

Search: