ColdFusion and Types

I saw an interesting thread on CFCDev about overloading, which lead to a few posts on types in ColdFusion, which lead to this post, which lead to the new survey off to the right. Basically, I’m curious about what people think about types in ColdFusion. Should ColdFusion be a more strongly typed language? Should typing be optional? What do you think the advantages would be? How far should it go (in other words, should there be a predefined set of types, or should developers be able to define their own types).

This is a tricky topic, and I’m not sure where I stand on it. I clearly see the advantages of ColdFusion being a loosely typed language, and I appreciate the flexibility and simplicity it allows. On the other hand, there are a lot of advantages to more strongly typed languages, mostly relating to compile type optimizations and validation (anyone who has gone from ActionScript 1 to ActionScript 2 knows what I’m talking about).

So what are your thoughts? Post here and take the survey!

11 Responses to ColdFusion and Types

  1. CF being loosely typed is probably one of the reasons it is so easy to use. I think CF should stay, at default, a loosely typed language.However, that being said, using a strongly typed language feels much more “safe” when I code. I’d love it if typing was an optional setting for CF. This way more advanced developers could turn it on. I’d be willing to bet this would allow CF to run quicker, and also make your code more secure.

  2. Rob Brooks-Bilson says:

    As Ray likes to say, “+1 that”.

  3. I’d love to see optional strong typing in CF. I experimented with it during my research work on language design back in the 80’s and found it very useful to be able to specify types for certain parts of a program but rely on dynamic typing for other parts.Both approaches have their pros and cons – it would be great if CF could provide the best of both worlds!

  4. Ivo D. Silva says:

    For some years now that Coldfusion is in the top of my choice list when it comes to develop web applications, partially due to his simplicity and direct-to-the-point nature.However since some months ago i found my self obligated to use PHP ( 4 & 5 ) and C# due to professional reasons. And i must admit, im starting to regain my passion towards c-like syntax. ( and also to discover new reasons why i chose coldfusion to be my prefered web application dev platform, compared to coldfusion, php’s output data solutions are hell )When im coding php i constantly find myself casting variables, weither by (type) ou settype(), and prefixing my variables by its expected data type. I just feel more secure by coding this way, when i know exactly what data type that variable should have – and it really helps me to debug things.Like Raymond said, this feature should be implemented in the next release of coldfusion. Not within its tag based nature but in cfscript. cfscript is beeing constantly relegated to a second plane when new versions and releases of cf arise. Why not make cfscript more ECMAish ( just like as2 )?This away the more cf hardcore coders could hv those most wanted features, and at the same time, php and others, that usually code in a c-like syntax away, could hv a more smooth transition to coldfusion, thus helping coldfusion userbase to grow even more ..just me 2 cents though

  5. Steve Nelson says:

    I think it’s more important to validate the type at architecture time, not at runtime. It’s like measuring a door will fit into a doorframe when you hang the door versus measuring the door every time you open and close it.

  6. Ivo D. Silva says:

    oops …’Like Raymond said, this feature should be implemented in the next release of coldfusion’ should be’Like Raymond said, this feature should be optional in the next release of coldfusion’litle mistype there

  7. ksuh says:

    Optional strong typing would move CF ever closer to the VB model of Doing Whatever You Want In A Million Different Ways For No Good Reason Other Than You Can, which sucks.Either go all the way, or none at all.

  8. Nea Laugman says:

    I don’t know that a strongly-typed CF is consistant with the easy-to-use RAD concept that is at the core of CF.Object Pascal (Delphi, which I am passionate about) is a strongly-typed language and it is wonderful for catching things at compile-time, but that’s the difference: there is no exe here. As Steve said above, CF doesn’t need to be doing that at runtime. Even in Delphi, it can get to be a silly thing if you wish to be careful and type-checking is one of the most cycle-consuming operations you can perform.And I doubt that there is anything MM could possibly do to make CF as miserable as VB/VBScript .

  9. Robby says:

    I’d have to agree with Sean, there is good reasons for both.But when it comes down to it, don’t bastardize cfscript. There isn’t really a point to killing something that has worked so well for so many years. More functionality in built in functions would be nice (well formed, dtd, xsd validation function comes to mind.)But if I were to openly suggest an implementation that would allow coldfusion to access and use other libraries in different languages, explore ecma based scripting or add functionality already implemented else where. I’d have to suggest The Bean Scripting Framework. Give me a tag that accepts an attribute of ‘type’ to pick which language and I have Tcl, python, javascript, beanshell, and jruby to pick from. Not only will I never have to reinvent the wheel again. It would add even more languages that ColdFusion would be compatiable to. Which would never be a bad thing.

  10. ksuh says:

    > And I doubt that there is anything MM could possibly do to make CF as miserable as VB/VBScript .Optional strong typing would…

  11. brian says:

    coldfusion should use mote type for sure