Ruby Lanuguage #1 -> :symbols

I started working on a Ruby project from this week.

It's a bit of being in wilderness. I found the language to be different than the ones i learned (C, C++, Java, C#, Visual Basic, Python). It looks like a script (Shell, JavaScript) but Wikipedia says otherwise.

Ruby is a dynamic, reflective, object-oriented, general-purpose programming language.
It supports functional, object-oriented, and imperative programming Paradigms. It also has a dynamic type system and automatic memory management.

The key to understanding Ruby is understanding the conventions in the language (and then in the libraries we use). In this blog post (series, if i am able to make) i will try to drill down into different ruby language features, starting from conventions used in the language.

itadakimasu, gochisōsama-deshita

"itadakiamsu" lit. means "I humbly receive"
"gochisosama-deshita" lit. means "I think it's a (honorable) feast".

These conventional sentences are used in Japan before and after a meal. They simply means that i am grateful for the food on this table (before meal), and i consider it a feast (after meal). This is neither a rule, not a gesture but a convention that has been carried since the 700 AD.

Ruby language has a lot of conventions. I am not speaking about the conventions laid out by the libraries (Rails, Sinatra, Powder, Rake), but the ones in the language. Some of them, as i understand

An instance variable is prefixed with a "@", a static variable declared at type scope is prefixed with a "@@" and a global variable declared at module scope is prefixed with a "$". In languages like C, C# the place where the variable is declared defines it's scope, and accessibility will be defined by a separate expressive syntax. In ruby the prefix determines both. There are bunch of other conventions like this one.

Similarly there is this concept of a "symbol" which is very much a variable, and a visual difference is that a symbol is prefixed with a ":" whereas a variable is not. If you are from Java / C#, think of symbol as an interned string held in a string intern pool. But wait ! Are you asking what is the scope of a symbol, or in other words is there a "instance symbol", "global symbol" (or) even a "local symbol" ?

Everything is an object

soundararajan