Javascript style operators in cfscript

19 views
Skip to first unread message

Richard Davies

unread,
Apr 11, 2011, 5:36:35 PM4/11/11
to fusio...@googlegroups.com
As of ColdFusion 8, JavaScript style operators (i.e. >=, !=, ==, etc.) are supported inside cfscript tags. But it appears that FusionDebug is unable to watch or inspect expressions that contain such operators. Is this a known issue? Is there anyway to get this to work?

Darren Pywell [FusionDebug Team]

unread,
Apr 12, 2011, 8:38:42 AM4/12/11
to FusionDebug
Hi Richard,

FusionDebug uses the expression evaluator of the underlying ColdFusion
engine to watch/inspect and set expressions.

Although the syntax is supported in cfscript it isn't supported by
ColdFusion's evaluation engine, for example:

<cfset x=evaluate("1 != 2")>

will return the follow error in ColdFusion:

Invalid CFML construct found on line 1 at column 3.
ColdFusion was looking at the following text:
!

The error occurred in C:\test\test.evaluate.cfm: line 1
1 : <cfset x=evaluate("1 != 2")>


Whereas

<cfset x=evaluate("1 neq 2")>

Will return YES

We made a conscious decision to use the underlying engine evaluator to
make sure the expression syntax that is supported by the engine will
work in FD. A workaround is to replace the Javascript operators with
CF's evaluate operators (gte, neq, eq, etc...) by editing or adding
the expression in that way. I have tracked a ticket for this against
FD, but really we need the underlying engine to iron out this
inconsistency and you might want to track an issue with the CF bug
tracker to add support for the CFScript/Javascript operators to the
evaluator in http://cfbugs.adobe.com

Cheers,
Darren

Richard Davies

unread,
Apr 12, 2011, 11:46:52 AM4/12/11
to fusio...@googlegroups.com
Thanks the the info, Darren. I had a feeling that was the problem. I just didn't know if it's possible to somehow to do the evaluation inside a CFSCRIPT tag. But I agree that the real issue is the CFML expression evaluator. I've submitted an enhancement request in the cfbugs database.
Reply all
Reply to author
Forward
0 new messages