JRS: In article <Xn*************************@127.0.0.1>, dated Mon, 17
Apr 2006 09:37:28 remote, seen in news:comp.lang.javascript, Duncan
Booth <du**********@invalid.invalid> posted :
You will find there are very few cases where you actually want to use eval.
Usually, if you think you want eval, you are mistaken and your code will be
cleaner and simpler avoiding it.
Except sometimes (treating the use of a new Function wrapper as morally
equivalent); I sometimes use eval for reading input controls.
That allows input by expression, so that where a distance in kilometres
is called for a user can enter a distance of 5 miles as 5*1.609 (or
something more complex to be exact), and 1/-0 can be used for -Infinity.
If the user chooses to put unreasonable code in, the consequences are
his problem, not mine.
Example in <URL:http://www.merlyn.demon.co.uk/$rnd.htm>.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.