Tags vs. CFScript

Now that you can write functions in both tag form and as CFScript, which way are people leaning and why? I like that tags allow a level of validation in terms of data types and requirements, however I must admit that I prefer the more streamlined syntax of CFScript. What are your thoughts? Should the same advantages that one gets from writing UDFs as tags be added to CFScript? Should CFScript become ECMAScript? Server-side ActionScript? Java? What?

18 Responses to Tags vs. CFScript

  1. Matt says:

    I prefer the Script method. I find it faster, easier and more like writing other languages.One drawback….I use scripti in place of tags wherever possible, but some functions – like CFQUERY – are just fater in tags.I think that script should become Java. With the improvments in CFMX 6.1 (ability to call super.x()) I would like to code more “like” sytax in my script blocks.Tags have their place, but script is faster to write – easier to read and allows more complexity in development – like nesting, looping, method invocation, structure manipulation, etc.

  2. Erik says:

    I still have mixed feelings with CFSCRIPT – I use it whenever possible, but I’ve always had trouble with the operator syntax. (GT, LT, etc.) It just doesn’t feel right. Personally, I’d love to see a script type attribute of “ECMA” in the tag. Backwards compatible and more robust for us old-school script junkies…Turning it into Java sounds like a nightmare, though – defeates the purpose of having a scriptlet-like tag, I think. If I wanted to program in Java, I’d program in Java. 🙂

  3. barneyb says:

    I have nearly the same thoughts as Matt:Scripting is faster to write, easier to maintain, and nicer to look at. The tags are necessary for some things, but any time I have more than 4 or 5 sequential lines that can be written in script, that’s the way I go.I usually write functions with tags, however, to get some argument checking, though the bodies of my functions are frequently almost exclusively CFSCRIPT.CFSCRIPT will never replace CF tags completely. CFQUERY, for example, is way nicer syntax than doing having to pass a string of SQL, like you have to do in Java or PHP. On the other hand, being able to do real for loops with script (just one small example) is a lot nicer than having to work within the confines of the CFLOOP tag.

  4. I love cfscript, it’s elegant and fast. As for functions, I would like more control in cfscript. CFFunction gets to specify return types, output y/n, access levels, etc, and CFArgument gets data validation, required or not and defaults. makes it hard to use cfscript in components.I would like a more java-style function definition in the future. Yes it’s easy now, but it would be nice to have more control.Also, it would be a plus if we could use non cfscript-able tags in cfscript, for example, cfquery can be made into a function and called via cfscript, but what about cflock?

  5. Ulf Unger says:

    I use CFScript whenever it is possible – even before ColdFusion 5. Now that the Tag based definition of UDFs are possible, I missed this enhancements badly in CFSCRIPT – and what about the possibility to create whole CFCs in CFScript. This would help Developers using Script Based languages (and even Java, C, C++) to understand and use ColdFusion as much as possible.BUT, nothing can beat Tags in presentation code – I love them. But for the backend it should be possible to choose, with CFMX now you have to use Tag based Programming.

  6. Mike says:

    Why not add a “language” attribute to the cfscript tag?

  7. I prefer to use cfscript when performing a lot of logic-like stuff. I would really like to have the ability to write my CFCs in script instead of the component and function tags.Though, I totally agree with Ulf about using the tags when working in the HTML layer. That’s where CF whoops ASP and JSP (pre taglib).

  8. Sam says:

    I do almost all tag based functions ever since CFMX beta. CFML is just so much more powerful than CFScript.If CFScript had full cf tag support the way ASR does then perhaps things would change. Certainly, I’d like to be able to write functions in Java right inside my CF files and that would be my preferred method.CFScript and CFML based UDFs are a lot less efficient than equivalent Java code, so having the ability to write small snippets in Java where performance is crucial would be great.

  9. dgibson says:

    As I recently posted in another blog on the topic of performance, if there any longer a performance benefit of using CFSCRIPT vs regular CF? With all the changes to the way CF works internally, I would think not, but I would like to hear some other views on teh matter.

  10. I’d definitely like to see CFSCRIPT get closer to ECMAscript. If nothing else, the closer it gets, the more you broaden CF’s potential base of developers.

  11. Dan says:

    I agree about making it close to ECMAScript. I’m a C++ programmer as well, and I miss function overloading. Also, being able to call certain functions from .CFM files through namespaces would be nice.

  12. Brian LeRoux says:

    I also would LOVE to see an ECMA-262 implementation in cfscript. It would empower ColdFusion and broaden the developer base significantly. (From actionscripter’s to Java and C# developers. Oh and that guy using JScript.net LOL) Components created via script syntax would be much easier to read and lend a great deal of credibility to our beloved tag based language.

  13. Todd says:

    I think you’re going to lose the “easy to learn” / “fast to develop in” if CFMX’s ing language were to take a ECMA route.

  14. I don’t like CFScript method. I prefer the Script method as well. It is indeed faster and easier to use. Plus I’m just too damn used to it now.

  15. Microgluf says:

    In my opinion, CFSCRIPT should allow to use the ECMA syntax and look like ActionScript 2, would all make sense for most of us that use ActionScript in Flash or simply require a bit more flexibility. It would make the whole CF/FL/MM solution complete.. But that shouldn’t be confused with server side actionscript. I still think CF is great but could do with a little more grunt for thos of use that like me hate the GT, GE kind syntax.I would even consider considering that the default could use the current Pseudo scripting language with the odd GT and LT.. syntax for CFers.. and newbees…Well that’s for my 2 cents…

  16. Microgluf says:

    My last post was missing part of it…. I suggested a CFSCRIPT tag that would add a language property like language=actionscript2 etc…