ColdFusion 9 CFScript Comments Handle Name-Spaces... And Just About Anything

Posted January 26, 2010 at 8:45 AM by Ben Nadel

Tags: ColdFusion

The other night, I was lying in bed thinking about ColdFusion 9 (hot visual!) when I wondered if ColdFusion 9's new CFScript-based JavaDoc-style commenting would accommodate name-spaced attributes. These have been supported by the CFComponent and CFFunction tags for a long time, but I wasn't sure if the JavaDoc-style commenting would be able to parse the ":" used in the attribute name. As it turns out, ColdFusion 9 will handle name-spaces properly.... and just about any other type of attribute you throw at it.

  • <cfscript>
  •  
  • /**
  • * @access public
  • * @returnType any
  • * @output false
  • *
  • * @kinky:functionType TestFunction
  • * @123 456
  • * @ ????
  • * @> Something
  • * @# Awesome
  • **/
  • function doSomething(){
  • return( "Hello" );
  • }
  •  
  • </cfscript>
  •  
  • <!--- Output the function meta data. --->
  • <cfdump
  • var="#getMetaData( doSomething )#"
  • label="doSomething Meta Data"
  • />

As you can see above, not only am I trying a name-spaced attribute, I'm trying attributes that either don't make sense (no name - "@") or wouldn't even compile in the tag-based equivalent. And, when we run the code, we get the following output:

 
 
 
 
 
 
ColdFusion 9's CFScript-Based JavaDoc-Style Commenting Supports Name Spaces... And Just About Anything Else. 
 
 
 

I don't have much to say about this - it was just something I wanted to check.




Reader Comments

Jan 26, 2010 at 8:57 AM // reply »
51 Comments

It was that very concept that started me down the path of http://hyrule.riaforge.org. Little did I realize that you grab that info in previous versions, but as they say better late than never :)


Jan 26, 2010 at 9:07 AM // reply »
11,238 Comments

@Dan,

Being able to use custom attributes is definitely very cool. I was just surprised that it allowed me to do things like set the attribute "123". Although, I guess they aren't *really* attributes at that point - they're just pieces of meta-data.


Jan 26, 2010 at 9:41 AM // reply »
29 Comments

These all work in annotation-sytle attributes, but some don't work in script-only inline attributes. For example,

/**
* @mxunit:expectedException "myException"
*/
function anMXUnitTest() {}

works, but

function anMXUnitTest() mxunit:expectedException="myException" {}

does not work (throws an error).

Just an FYI.


Jan 26, 2010 at 9:43 AM // reply »
51 Comments

Good to know Bob, thanks!


Jan 26, 2010 at 9:45 AM // reply »
11,238 Comments

@Bob,

Good to know. On a side/related note, I happen to dislike the way inline attributes look post-signature... just seems awkward. I've started to actually like the way the JavaDocs style stuff works - it keeps the function itself simple.


Jan 26, 2010 at 9:52 AM // reply »
51 Comments

I could not agree more Ben, I think that syntax is really fugly ;)


Jan 26, 2010 at 9:54 AM // reply »
11,238 Comments

@Dan,

Right? Before the function, ok (public, return type); but after the method parameters / before the opening bracket... junky!


Jan 26, 2010 at 10:00 AM // reply »
29 Comments

@Ben and Dan,

We'll just have to agree to disagree about that one, boys ;-)

I understand that they might not look appealing, but I personally abhor the idea of putting code that affects execution into what appears to be a comment. Perhaps I'll come around one day.


Jan 26, 2010 at 10:02 AM // reply »
51 Comments

When you can show me that the execution is causing performance issues I will listen :) HA..


Jan 26, 2010 at 10:06 AM // reply »
11,238 Comments

@Bob, @Dan,

We're a good crowd here:

Dan loves JavaDocs.

Bob says JavaDocs are crazy.

Ben says, it's all moot since TAGS are where it's at :)


Jan 26, 2010 at 10:09 AM // reply »
51 Comments

I am going to buy the following domain and point it to your website Ben. HA ;)

http://www.tagsareforui.com


Jan 26, 2010 at 10:18 AM // reply »
11,238 Comments

@Dan,

Ha ha ha, awesome :) Tags FTW!


Jan 26, 2010 at 7:07 PM // reply »
2 Comments

I was thinking maybe if we could use it just like javadoc someone would even build a plugin for Eclipse called CFDoc. That would be rad.


Jan 29, 2010 at 4:59 PM // reply »
10 Comments

I agree with Bob. I don't like the idea to mixing code with comment! Just doesn't seem right. Also, I'm scared that a noob may look at it as comment and remove it :)...


Feb 5, 2013 at 10:00 AM // reply »
1 Comments

awesome... grreeeeeeaaaattt :)



Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
May 21, 2013 at 7:46 PM
Using Plupload For Drag & Drop File Uploads In ColdFusion
No luck. At least I have uncovered the cause, URLScan 3.1. Here is what I see in the IIS log when a file is over 30mb. 2013-05-21 23:29:05 10.105.45.128 GET /plupload/assets/jquery/jquery-1.8. ... read »
May 21, 2013 at 6:12 PM
Using Plupload For Drag & Drop File Uploads In ColdFusion
Ben, I did not see you after Pete Freitag's Lockdown session at cfObjective but he said that IIS sets file size limits at 30MB by default which just happened to be the threshold for file size when ... read »
May 21, 2013 at 11:51 AM
Ask Ben: Parsing Very Large XML Documents In ColdFusion
Looking at my first ever XML document that I have to parse and put into MS SQL 2000 with CF8. I get it to list the desired Field name, many times over, and have a long list of this field name displa ... read »
May 21, 2013 at 9:25 AM
Turning Off and On Identity Column in SQL Server
you are awesome..i am lucky to get this blog between such a garbage one....Thanks, Prashant ... read »
May 20, 2013 at 4:38 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
@Dana, Your confusion is well founded, since this is a very confusing features. In fact, it ONLY works if you use array notation. Meaning, that this: arrayToList( query[ "columnName" ] ) ... read »
May 20, 2013 at 4:34 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
I was thinking chicken and the egg, I wouldn't have expected it to work in the valuelist going in I guess. Maybe I just need a beer, long day :) ... read »
May 20, 2013 at 4:29 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
@Dana, That's if you're trying to reference a specific row. In this case, we're trying to reference the entire query column as one cohesive value. So, you are correct that if you wanted to output a ... read »
May 20, 2013 at 4:24 PM
Using A Dynamic Column Name With ValueList() In ColdFusion
I thought when you used array notation to reference queries you always had to have the row or it would throw a similar error as well? ... read »
InVision App - Prototyping Made Beautiful With Prototyping Tools