3

So I was reading through some ColdFusion code and I ran across a function that had the dollar sign in front of it so $myFunction. I would like to know if this is some ColdFusion convention if not then what is the purpose of using such a coding style?

Community
  • 1
  • 1
John
  • 13,197
  • 7
  • 51
  • 101
  • Click on the [code](http://stackoverflow.com/questions/5155929/coldfusion-converting-form-values-into-a-struct/5163541#5163541) link – John Nov 16 '11 at 14:12
  • 3
    I think it's just the style the user used. I don't care for it myself. – Raymond Camden Nov 16 '11 at 14:38
  • 2
    I think it's a naming convention. Like using $functionname() where functionname() is an internal function of a class. I once used code where $-suffix indicated that the function returned a string instead of the non-suffixed function that returned an object, like address$() and address() – jan Nov 16 '11 at 14:49

1 Answers1

12

We do that for three reasons in cfwheels:

  1. You know what is a private/public method that belongs to the framework API just by looking at them.

  2. We don't collide with the new methods names that are now part of full script support.

  3. We don't take up a popular method names for components.

ale
  • 6,369
  • 7
  • 55
  • 65
rip747
  • 9,375
  • 8
  • 36
  • 47