Search code examples
coldfusioncoldfusion-9code-hinting

Are there non-aesthetic differences to consider between hinting techniques when writing in CFScript?


I'm aware of two methods to write code hints in CFScript. I would like to know if there are any functional, non-aesthetic differences between the two, and what's considered best practice.

The first technique I've seen uses comments above the function's declaration to add hints:

/**
* @hint This function does soemthing
*/
public function foo() {}

While the second technique incorporates the hints into the declaration itself:

public function foo() hint="This function does something" {}

Are there reasons to use one and not the other? Does your approach change if you have arguments to declare that you may want to hint?


Solution

  • There is no functional difference that I am aware of between using the annotation style /** */ and inline. Also, it's not just hints - any attributes can be placed in the annotation or inline. As far as I am aware it's purely an aesthetic choice.

    To clarify:

    /**
    *@output false
    *@returnType query
    */
    public function foo() {}
    

    Will functionally do the same exact thing as

    public function foo() output='false' returntype='query' {}