From: Sean Middleditch Date: 2002-04-03T09:39:02+09:00 Subject: Re: Is eval a code/design smell? Personally, I agree with you for a number of reasons (you can find my posts whining about eval in the list archives). Mostly, tho, my biggest gripe with it is that it's used when there are (or should be) better ways of doing things; I find any program that uses eval() to be badly designed. If there is some task that can only be performed with eval(), then I would say its a flaw in the language - the most common uses of eval() that I can find are mathmatical evaluation of user input, and looking up variables/members. So far as I'm concerned, the former should be done with a specialized, high-performance math library (which *are* available), and the later should be (and is, with many languages) a language feature. Using eval() is, more or less, a low-performance hack-ish solution to a problem that can be solved in a more elegant solution, with less of a security risk. But that's me. ^,^ On Tue, 2002-04-02 at 19:11, Chris Morris wrote: > I seem to have an inherent distaste for eval, but I don't know why. I've > heard it has performance concerns, but that seems to be the only pragmatic > reason to not use it in cases where that matters. Are there any other > pragmatic concerns with eval? Is its use a design red-flag? Is there > something to my gut instinct, or is it a holdover from my strong-typing > past? > > Chris >