This works... and it freaks me out

I just ran across a template that had an interesting typo. Here is an example.

component {

	{
		public function hello() {
			return "Hello";
		}

	}
	
}

See it? The function is surrounded by an extra pair of brackets. ColdFusion just hoists it up just like JavaScript, so I shouldn't be surprised, but wow did that freak me out a bit.

Then for the hell of it I went crazy - and yes - it still works.

component {

	{
		{
			{
				{
					{
						public function hello() {
							return "Hello";
						}
					}
				}
			}
		}
	}

}

Anyway... yeah... don't do this. ;)

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for Extend by Auth0. He focuses on serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA https://www.raymondcamden.com

Comments