On 15 July 2010 09:38, Abder-Rahman A. [email protected] wrote:
“The Rails Way” book mentions the following regarding the create_table
Why do we specify identifiers with symbols instead ofstrings? Both will
work, but symbols require one less keystroke.
What is meant by: “But symbols require one less keystroke?”
one has two quote marks; the other only one colon.
But “less keystrokes” is a glib argument in favour of symbols… a
better reason for using symbols over strings is that symbols are more
efficient in memory. They act like pointers to a single string, where
quoted-strings all exist individually in memory, so if you use the
same string a lot, you use lots more memory than if you use the same
symbol a lot.