Another question inspired this one:
Mostly everybody agrees that eval
is bad, and in most cases there is more elegant / safer replacement.
So I wanted to ask: if eval
is misused that often, is it really needed as a language feature? Is it doing more evil than good?
Personally, the only place I find it useful is to interpolate strings provided in config file.
Edit: The intention of this question is to get as many real-life cases as possible when eval is the only or the best solution. So please, don't go into "should a language limit a programmer's creativity" direction. Thanks!
Edit2: And when I say eval
, of course I refer to eval
ing string, not passing ruby block to instance_eval
or class_eval
.