Johannes Friestad wrote:
...
> 
> HOST = :host
> PORT = :port
> foo1 = {
>     HOST => 'localhost',
>     PORT => 80
> }
> 
> which is equally safe, simpler to read, doesn't need the ConstUtil,
> and automagically gives a constant with a readable string value.
> 

My hack was a quicky to flesh out the example.  After sending it I 
thought about assigning symbols.  My main point was that if one mistypes 
a symbol name, Ruby doesn't care.  Unit tests should catch this, but 
using constants might just help things along because of the immediate 
error.    And it might more clearly express intent.


James

-- 

http://www.ruby-doc.org       - Ruby Help & Documentation
http://www.artima.com/rubycs/ - Ruby Code & Style: Writers wanted
http://www.rubystuff.com      - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com     - Playing with Better Toys
http://www.30secondrule.com   - Building Better Tools