On Sun, 2003-06-01 at 11:21, Joel VanderWerf wrote:
> One advantage of symbols is that they know how to print themselves, but 
> you can of course get this advantage with constants that refer to symbols:
> 
>    UP = :up
>    DOWN = :down
> 
>    x = UP
>    puts "You are going #{x}"
> 
> Another advantage with constants is that, if you want to change the 
> value, there's only one spot in the code to change and you don't break 
> the API.

Well, yes ... but I imagine that in the cases we are talking about the
actual value of the constant is irrelevant.  In fact, if I were to use
constants, I would consider doing ...

   UP = Object.new
   DOWN = Object.new

Now I can't accidently use :up or :down in my code.  I _must_ use the
constant.

Since the value is unimportant, changing the value is unlikely. 
However, it is possible that I later decide the constants should be
named TOP and BOTTOM instead of UP and DOWN.  And this is a problem for
both symbols and constants equally.

-- 
-- Jim Weirich     jweirich / one.net    http://jimweirich.umlcoop.net
---------------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct, 
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)