Question

Now that we're on a cf10 server, I'm exploring the cfscript syntax with all my pet projects.

For example: my base template for all my pages could potentially change from:

<cfinclude template="/Inc/html.cfm">
<cfinclude template="/Inc/body.cfm">
Hello World!
<cfinclude template="/Inc/foot.cfm">
<cfinclude template="/Inc/End.cfm">

to:

<cfscript>
include "/Inc/html.cfm";
include "/Inc/body.cfm";
WriteOutput("Hello World!");
include "/Inc/foot.cfm";
include "/Inc/End.cfm";
</cfscript>

So I'm concerned about what I don't know. For instance, if I starting using the script syntax for all my new work, am I limiting myself to not using Railo in the future?

So far, I've used Adobe ColdFusion and Microsoft SQL Server exclusively, but I'm going to be giving a talk at iccm.org in a few months and I'm sure the audience will want to know about Railo and mySQL as alternatives.

What corner am I painting myself into if I start using cfscript syntax?

Was it helpful?

Solution

No, you are not limiting yourself to not using Railo in the future. I have come across very very few incompatibilities - one trivial one I can think of - with ColdFusion in Railo's CFScript implementation.

Railo on the whole strive for cross-compatibility with ColdFusion with their CFML, and they generally only veer away (by design) when the ColdFusion way is just wrong in any sensible way of measuring such things. But even then, generally Railo has a "warts and all" approach.

As there's not really much to CFScript, and the functionality of control structures is fairly "pre-determined" (eg: there's only really one interpretation of how an include statement can work), I don't see this becoming a problem.

OTHER TIPS

Railo's version of CFscript is much more advanced/developed and far more developer friendly and nice to play with, however it'll also run your coldfusion cfscript fine, if there is any issues it'll be small. I recommend only using cfscript in cfc's and in view .cfm files use cfml, thats where it looks good, other languages try for all kinds of templating engines eg. php has twig, smarty etc, however cfml in views in just perfect, however its nasty in cfcs once you get used to writing purely cfscript all the time you'll not only find cfml repulsive you'll be able to jump between other languages much easier

I don't think you will run into issues using cfscript in Adobe ColdFusion versus Railo. As Adam mentioned, Railo tries to stay compatible with Adobe as much as possible. However, my issue with cfscript is that not all tags are supported. So as soon as you need to use one of the unsupported tags then you have to break out of cfscript, write your tag based code, and then start cfscript again. It is functional but ugly if you have to do this. I have been trying to write more and more of my code in cfcs and can typically write those using cfscript syntax. However, I find that in my main templates I still use the tag based syntax more often.

Here is a page that lists the supported tags in cfscript for Adobe ColdFusion: What is supported in CFScript

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top