msgbartop
Code Musings and Such
msgbarbottom

24 Sep 08 ColdFusion Dynamic Variable Names

I was just browsing the ColdBox Frameworksource code and I saw something that I didn't know was possible.

<cfset "instance.context.#arguments.name#" = arguments.value>

I would have written it like so:

<cfset instance.context[arguments.name] = arguments.value>

I can't think of a reason to use one over the other. Sway me.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Tags: ,