the "evaluate" email I sent was reall just a joke because Sean left it out, technically it will work , and because Ray's got a bit of a reputation for detesting it.  I don't generally advocate the use of evaluate - it's slower and the code is usually uglier.  Since Sean askeed for a scenario when you would want to use it, I will give you one.  One of the applications I built had a drop down list that showed all of the nodes in an XML file - in hierarchial format (indented, etc. like a tree).  When you selected a node and submitted the form, the next page allowed you to edit that particular node.  Passing the string that represents the full path to the node and then evaluating it in order to pull all of the data for that node was by far the best approach.  You may be wondering why I couldn't just pass a string that worked as an XPath statement.  As XML packets grew, it was too resource intensive to generate working XPath strings (the XML would require a lot of business logic to do this)... however, simply looping over the XML once to build the path to the name of the node, which is what I needed to display in the drop-down anyway, was the fastest, most elegant solution.  Anyway, as Sean has stated, you pretty much never actually need evaluate - there's almost always a more elegant solution.

~Simon
Simon Horwith
CIO, AboutWeb - http://www.aboutweb.com
Editor-in-Chief, ColdFusion Developers Journal
Member of Team Macromedia
Macromedia Certified Master Instructor
Blog - http://www.horwith.com



Sean Corfield wrote:
On Wed, 16 Mar 2005 13:21:10 -0000, Robertson-Ravo, Neil (RX)
<[EMAIL PROTECTED]> wrote:
  
Sean, can you give a case where it is a) unnecessary and b) required with
regards to dynamic processing - I think this would help clarify the
situation.
    

No, every case I've seen can be coded without evaluate().

  
I used to avoid it like the plague on advice of others but really I haven't
really found any huge performance hit with it and in some cases you have to
used it when evaluating data - is there some hidden way to avoid using
Evaluate?
    

Show me a case where you think you really need it.

  
If its not required or not advised when it comes to use - why is it still in
the CF dictionary and not deprecated and been replaced with a faster more
efficient means of dynamic evaluation.
    

I think a lot of code relies on evaluate() - pre-MX you couldn't just
mess with scopes as if they were structs so you needed it back then.
>From MX onward, there is already a "faster more efficient" way to
avoid evaluate(). I would like to see it deprecated but it isn't my
choice to make.
  
---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com). An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to