Mage
1/23/2006 7:10:00 PM
Mark Volkmann wrote:
>
>There was a long discussion about what symbols are recently, so I
>hesitate to try to simplify this, but here goes. Think of a symbol as
>a string that will be the same object in memory each time you use it.
>For example, "foo" and "foo" will be two different objects in memory,
>but :foo and :foo will refer to the same object.
>
>
I think I understand now, thanx.
>
>
>
>>The benefits I can see are variable length arguments, and the arguments
>>placed don't have to be in the same order. Coming from java, I'm
>>actually a little wary about this, but I sort of understand the
>>usefulness, especially after reading the Rails book.
>>
>>
>
>I don't think it's common in Ruby to use Hashes for this purpose.
>Usually methods have fixed parameters and you don't pass them in a
>Hash.
>
>
Actually, database connection parameters are good example for variable
length arguments. Sometimes you want to skip the port number and the
authentication data, other times you want only defne the user and the
database name.
Mage