Good points all...
What is needed are some good examples so that we can understand what the
alternatives are and why they are better than evaluate(). Examples of what
evaluate *should* be used for would also be useful.
For me, dynamic forms were where I learnt to NOT use evaluate.
a form field like <input name="name#userId#">
I would access via something like <cfset theName =
evaluate("form.name#userId#")>
When in reality I can use <cfset theName = form["name#userId#"]>
which might not be much different in execution time but is a much better coding
practice simply because it reduces the complexity of the code for the trainee
programmer who comes along to alter it later.
Can anyone supply a simple example of an 'acceptable' use of evaluate()?
Cheers,
Brett
B)
Adam Cameron wrote:
> G'day
> My testing recently suggested that terrible the performance hit one
> used to get with evaluate() has all but gone now. So that's good.
>
> The only gripe I have with it is that people tend to over-use it: it's
> seldom the correct answer to a question about dynamic variables or any
> other situation where one's inclination might be to use it.
>
> You touch on one instance when it seems to be necessary to use it, and
> I can think of a couple of others, but a lot of people seem to use it
> every time things get slightly confusing to them. These are perhaps
> the same people #who# #put# #pound-signs# #around# #everything#, "just
> in case".
>
> My position is this:
> 1) if one can reasonably NOT use evaluate(), then don't.
> 2) if one thinks "I need to use evaluate() for that", have another
> small think about it before deciding it's the right answer.
> 3) and, yes, sometimes it's unavoidable. In these cases, there's no
> need to feel like one is doing something wrong.
>
> I think it's a three-step process before settling on using it.
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"cfaussie" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---