Recently I noticed many languages released or emerged, such as GO, NOOP, Simple for Android, and the one by vim author (sorry I cannot remember it).
Days ago, Google released a new language named ‘GO’. It is available at http://golang.org.
This is interesting, because recently google released a couple of language tools. I am wondering: will it be natively supported by the possible upcoming Google Chrome OS?
I looked around the language grammar, and notice something interesting:
1. Is GO a dynamic language, or strong typed? Look at the variable declaration. They have the keyword ‘var’ which implies dynamic typing. However, you can specify the variable types!!
var i int; // define an integer. Doesn’t it look strange?
var x, y float = -1, -2; // define 2 floating numbers. The initializers are even stranger.
var a, b, c = 2.0, 1, “hello, world”; // they have different types. This looks like tuple in Python.
2. The authors try to reduce keyboard typing.
If you look at the if-statement or for-statement, you will notice that the parenthesis follow if/for is eliminated, although you can still use them, (because if/for statements expect an expression, while parenthesis enclosed expression is still expression).
3. The semicolon plays an important role. It is used a lot as statement delimiters. They don’t use NEWLINE. NEWLINE is treated as space char.
4. The switch statement is interesting. It helps to reduce the ugly of if-else-if-else-if-else statement. By their grammar, the code formatting can be prettier:
case a < b:
case a == b:
case a > b:
5. There is no while statement. Neither is do-while statement. They don’t even reserve while as a keyword!
6. The package import implies dynamic package loading. In Java/C#/Python/C++, generally you use a qualifier to denote a package name, such as: import java.util.Date.
In GO, it’s different by using string:
I think it implies that they want dynamic loading of packages. It will be much easier to compute a string at runtime, and then import the denoted package.
The above are what I have found so far. Haven’t installed the language environment so far. I probably will do it in December, after my CFA examination. 🙂