Saturday, December 26, 2009

Experimenting with Coldfusion 9

I have finally started playing with Coldfusion 9, and I must say I'm impressed thus far. I am extremely pleased to be able to write components completely in CFScript. I have been dreaming of doing so for at least four years. While I love CF's tag structure, it feels clunky and arduous at times.

That said, I've stumbled upon my first problem that I haven't been able to find a solution to:

How do you (or rather, can you) explicitly type return values for functions or inbound arguments to user defined components?

For instance:

public [objpath] function doSomething(required [objpath] myObject){

I am one of those people who compulsively likely to explicitly type things, so any input would be fantastic!

---------------------- UPDATE

>>> View Ben Nadel's response to my question <<<

It turns out that there are several ways to solve this problem. The first is by using application mappings and dot-notation in the declarations of your method. The second is through comment meta-data attributes for your method directly preceding the method declaration. The third way is by using an IMPORT statement along with your application mapping to reference your objects just by their object name (much like in Java). For Ben's examples and details, click the link above.

I will put together a more thorough example this weekend.