[cfaussie] Re: Talking of evaluate()

2006-12-08 Thread Adam Cameron
Semantics aside, the reason I stopped using isDefined() is because it was flaky, and returned false positives sometimes. One could have code like this: cfif isDefined(session.foo) cfoutput#session.foo#/cfoutput /cfif And it *could* error, saying session.foo doesn't exist. Note, this was

[cfaussie] Re: Talking of evaluate()

2006-12-08 Thread M@ Bourke
ISdefined is whacked cfset session.session.session.crap = 1 structkeyexists(session, crap) returns false isdefined(session.crap) returns true also isdefined is slower. now some people say speed difference is never enough to worry about but try saying that to a site that's running a cluster of

[cfaussie] Re: Talking of evaluate()

2006-12-08 Thread Adam Cameron
Presume you mean: isdefined(session.crap) (note: quotes)? I tried this code: cfapplication name=testIsDefined sessionmanagement=true cfset session.session.session.crap = 1 cfoutput structKeyExists(session, crap): #structKeyExists(session, crap)#br / isDefined(session.crap):

[cfaussie] Re: Talking of evaluate()

2006-12-08 Thread M@ Bourke
On 12/8/06, Adam Cameron [EMAIL PROTECTED] wrote: Presume you mean: isdefined(session.crap) (note: quotes)? lol most peoples brains won't throw errors to pseudo code. isdefined(session.crap) will return true isdefined(crap) should be true structKeyExists(session, crap) should be false

[cfaussie] Re: Talking of evaluate()

2006-12-08 Thread Adam Cameron
G'day Mat I hate to be a fly in the ointment, but you're quite wrong with most of what you say about isDefined() in your preceding post. isdefined(session.crap) will return true It will error. If your double-quote key is missing and you actually mean isdefined(session.crap) (which is a

[cfaussie] Re: Talking of evaluate()

2006-12-08 Thread M@ Bourke
G'day Mat I hate to be a fly in the ointment, but you're quite wrong with most of what you say about isDefined() in your preceding post. G'day Adam, Get out of my ointment LOL after some googleing I found the following.

[cfaussie] Re: Talking of evaluate()

2006-12-07 Thread Adam Cameron
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

[cfaussie] Re: Talking of evaluate()

2006-12-07 Thread Brett Payne-Rhodes
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

[cfaussie] Re: Talking of evaluate()

2006-12-07 Thread Simon Haddon
One example that I have is when I have a free text field, (ie: in a form builder) and the person building the form is allowed to use coldfusion variables to pull out values at run time. I parse he string for any # symbols and then build an appropiate string to evaluate. I find evaluate works

[cfaussie] Re: Talking of evaluate()

2006-12-07 Thread Robin Hilliard
On 08/12/2006, at 12:40 AM, Brett Payne-Rhodes wrote: Can anyone supply a simple example of an 'acceptable' use of evaluate()? Cheers, Brett B) I've written a very simple (one cfc) unit testing framework that some of our clients have been beta testing over the last few months. One

[cfaussie] Re: Talking of evaluate()

2006-12-07 Thread Simon Haddon
Totally agree about isDefined. It is one function that I wish was never created. The number of times it has caused grief I have lost count of. Not the the function itself is wrong it is just that it is badly used within alot of code. Cheers, Simon On 08/12/06, Robin Hilliard [EMAIL PROTECTED]

[cfaussie] Re: Talking of evaluate()

2006-12-07 Thread Andrew Scott
: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Simon Haddon Sent: Friday, 8 December 2006 12:03 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Talking of evaluate() Totally agree about isDefined. It is one function that I wish was never created. The number of times

[cfaussie] Re: Talking of evaluate()

2006-12-07 Thread Simon Haddon
*To:* cfaussie@googlegroups.com *Subject:* [cfaussie] Re: Talking of evaluate() Totally agree about isDefined. It is one function that I wish was never created. The number of times it has caused grief I have lost count of. Not the the function itself is wrong it is just that it is badly used

[cfaussie] Re: Talking of evaluate()

2006-12-07 Thread Andrew Scott
: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Simon Haddon Sent: Friday, 8 December 2006 12:31 PM To: cfaussie@googlegroups.com Subject: [cfaussie] Re: Talking of evaluate() Hi, I think that your statement about using cfparam sums it up well. It is all about code design

[cfaussie] Re: Talking of evaluate()

2006-12-07 Thread Pat
: [cfaussie] Re: Talking of evaluate() Hi, I think that your statement about using cfparam sums it up well. It is all about code design. If all you variables are declared and initialised at the beginning of a template, custom tag, function or cfc then it improves readability and maintainability

[cfaussie] Re: Talking of evaluate()

2006-12-07 Thread Andrew Scott
Hey Pat, I am sure I scoped the example, and anyone who doesn't scope their variables should be shot *lol* Andrew Scott Senior Coldfusion Developer Aegeon Pty. Ltd. www.aegeon.com.au Phone: +613 8676 4223 Mobile: 0404 998 273 --~--~-~--~~~---~--~~ You

[cfaussie] Re: Talking of evaluate()

2006-12-07 Thread Simon Haddon
I have taken on a site earlier this year where variables are not always scoped, are not cfparamed, are not created with the var at the start of a cffunction, etc. It has made an otherwise good idea into a pain to maintain and enhance. Also, they person that wrote it believed in self documenting

[cfaussie] Re: Talking of evaluate()

2006-12-06 Thread Mark Mandel
function getScope(scopeName) { switch(arguments.scopeName) { case application: return application; break; case request: return request; break; //and on as required. } var scope = getScope(request); return scope[key]; See - not so