[Javascript] Good vs. Eval (was Form validation)

allard schripsema allard-schripsema at procergs.rs.gov.br
Tue Jan 20 12:13:53 CST 2004


I don´t know if I´d call this thread good vs eval  but here i go:

What would you prefer?

compare(parent.frame2.formWhatever.Input1,parent.document.formWhatever.Input
2)
or
 compare(sInput1,sInput2)
readability is one reason to pass strings instead of objects and do the eval
afterwards.

Another reason  may be that you gain productivity if you accept both strings
and objects in functions in your codelibrary (we have 400+ functions).
Programmers won´t have to guess/ lookup what is expected.

Coding with Eval is much more efficient than for example switch / case.
Remember that every character goes though the internet.




----- Original Message ----- 
From: "Matt Barton" <javascript at mattbarton.org>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Tuesday, January 20, 2004 1:57 PM
Subject: Re: [Javascript] Good vs. Eval (was Form validation)


> I'm inclined to agree.  I've never had cause to do that (call a function
> based on contents of a string variable) in Javascript, but exactly the
same
> thing is possible in PHP.  In my darker moments I have been known to us
it,
> but I've never liked to.  It's normally the result of a bad code design
> descision I have made in the past which I've neither the time or
inclination
> to resolve.
>
> Just as evil is $$variablename.  But that's not just another thread, it's
> another mailing list...
>
> Matt
>
> ----- Original Message ----- 
> From: "Chris Tifer" <christ at saeweb.com>
> >
> > To me, this goes back to "There's always some other way..."
> >
> > :)
> >
> > Chris Tifer
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
>




More information about the Javascript mailing list