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

Why is it so important to save on symbol table if it does make language less intuitive (at least for people with C background)?

Because Pascal-style declarations are superior in readability. With type inference, they also allow less typing ("foo :=" instead of e.g. "auto foo =").

You are going a learn a completely new language, new idioms, new standard library, new tools, and you're arguing that switching to a different style of declarations, a very very minor detail, is "less intuitive"? I'm not sure how intuition applies there: are you learning a language by trying to compile what you typed without reading any documentation or what?

Again the designers of Go could have implemented exceptions and let programmers choose what mechanism they prefer.

Because making them optional doesn't work well. If someone uses exceptions and someone not, combining code from those two people will make you use both exceptions and error returns. It would be even messier than indicating errors in C (does this function return 0 on error or -1 or what)?



It's arguable that the Pascal-style declarations are superior in readability.

I've discussed this with colleagues in the past, and those who were raised with English as their native language, for example, often find C-style declarations easier to comprehend. They find the adjective (that is, the type) coming before the noun (the variable name) more natural.

The opposite happens for those whose native language is one where adjectives follow nouns. They find the Pascal convention easier to comprehend.


The existence of this website http://cdecl.org/ confirms that even English speakers find it hard to read C-style declarations :-)

Plus, types can be seen as nouns instead of adjectives:

    int x
    variable x is an integer
    var x int


The English speakers must not have taken many math courses: there type declarations much more commonly come after the variable name than the other way around, although both styles are used. I mean "Let G be a group and f an automorphism of G" is much more common than "Consider a group G and an automorphism of G, f".




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

Search: