David A. Black wrote:
> eval is not safe in any situation where there's any possibility that
> you're executing text of unknown origin or suspicious composition. As
> in:
> 
>   command = gets.chomp
>   eval "system('#{command}')"
> 
> An extreme example, but you see the point :-) When the input is not
> suspicious, eval still often has a bit of a flavor of a brute-force
> approach to doing things that there might be a more elegant way of
> doing.

Thanks David and Farrel! Certainly, the Object#const_get() is a much
more elegant approach. Besides eval() smacks too much of the "&" macro
operator used in dBase and it's derivatives... yuck!


-- 
Posted via http://www.ruby-forum.com/.