4 ms·
Please don't do this. There are proper debuggers for Ruby that you can use to accomplish everything described here and more, and all without opening gaping secu
by jballanc 17y ago
Please don't do this. There are proper debuggers for Ruby that you can use to accomplish everything described here and more, and all without opening gaping security holes or beating the metaprogramming facilities in Ruby to a bloody pulp.
Also, I vote for Ruby's new motto to be: "Just because you can, doesn't mean you should."
- Fixnum 17y ago"Just because you can, doesn't mean you should." In particular, this Applies to Eval.
- windsurfer 17y agoFor some small applications, it can be handy to eval a configuration file that is simply a language data structure. It's like having a built-in config file parser. It also gives to lots of flexibility with your hacks :)
- viraptor 17y agoSome languages are nice enough to provide functions that parse the text into native data without the need for evaluation (like erlang's erl_parse/erl_scan; I guess lisps can do the same)
- jballanc 17y agoThat's why I said "Just because you can, doesn't mean you should" and not "Don't even think about it". 'eval' exists for a reason, and there are certainly good reasons to use it. This is not one of them.
- jrockway 17y agoI like to say, "There's more than one way to do it, but your way is wrong."