18 Apr 2020
The Rosetta Stone is a black granite slab that was carved with the same text in 3 different languages, around the year 196 BC. These languages were Ancient Greek, Demotic Egyptian and Egyptian hieroglyphs. The latter was never understood until the stone was discovered for the western civilisation.
It seemed the Greek and Demotic texts were telling the same story, so scholars studying these writings had the brilliant assumption the undecipherable hieroglyphs on the top of the stone would also convey the same meaning. They used the known languages as a guide to decipher the hieroglyphs, first finding some easy names such Cleopatra and Ptolemy, later the full text. Being able to translate hieroglyphs opened the gates to understand all the old Egyptian writings out there that were a complete mystery for the modern world.
Nowadays, the Rosetta Stone is displayed at the British Museum. If you wonder how it looks like, I took these pictures in December 2012 (during my first visit to London).
I remember when Golang was released and made available on Google App Engine, in 2011. I already had a Python website running on GAE, and the new language piqued my interest. However, it looked raw and primitive compared to Python, and the lack of HTML templates among other web application goodies that I considered essential… made me discard the novelty. I must say Go provides concurrency features out-of-the-box which is something very attractive, but those weren’t tools my website would have benefited from.
Finally, last month I faced some sluggishness at work on some Ruby code we use to read and parse big XML files. It was one of those Ruby limitations: the language is slow, no big surprises here. It’s the price we pay for the productivity.
I thought there could be a chance to write that part in a different, faster language. Motivated by these benchmarks and my past experience with C (too raw), Java (memory hungry), PHP (ugly) and Python (slow) I decided to jump into the unknown and do something exciting such as learning a new language: Go!
Golang is fast, produces very small binaries and does not require lots of memory to run. In terms of language design philosophy, feels like Python to me because its simplicity. Sometimes, even too simple and bare. Feels like C too, but does not let you blow up your foot. In any case, a 100% orthogonal depart from Ruby.
I’ve done 2 toy projects so far, an HTML to PDF conversion server and a Markdown wiki, and I can list some features any Rubyist will surely find odd:
- compiled, statically typed: you’ll have to think twice what you write if you don’t want to lose time compiling.
- no built-in REPL to try out quick hacks: although you could use gore, it’s not as polished.
- error management is done via return values and not exceptions, however there are runtime exceptions.
- missing lots of nice methods for hash and array manipulation.
- gems are awesome.
I’m a firm believer in learning by example, and I found very useful the official reference guide, and this nice site. Another convenient way to quickly get the feeling of a language is using something like the Rosetta Stone so your brain can infer new meanings based on prior knowledge.
Here it is such stone, for Ruby, Python and Go:
Go | Python | Ruby |
---|---|---|
|
|
|
Conditional operators | ||
|
|
|
|
|
|
Loops | ||
|
|
|
|
|
|
|
|
|
Lists | ||
|
|
|
Associative arrays | ||
|
|
|
|
|
|
Regular expressions | ||
|
|
|
Check in often, it may suffer updates from time to time.
If you are interested into other tables for other languages, see:
Examples: