Ok, time’s up. If you said it wouldn’t run, because, of course, it doesn’t need to, then you would be wrong. Even when url.name exists, getfoo() is executed. Now, in some ways, this is consistent with cfparam’s behavior. But to me, that always made sense. When I see this: <cfparam name="url.name" default="#getfoo()#"> – I always figured the compiler had to run getfoo to get the value to cfparam so cfparam could then work. Maybe you don’t agree – and that’s cool – but it makes sense to me.

In the case of the Elvis operator though it does not make sense. As an FYI, both Railo and Groovy ignore the right hand side when they don’t need it.

Share this:

Post navigation

Sponsors

The Author

I'm Raymond Camden, a developer advocate for IBM. My primary focus is on MobileFirst, hybrid mobile development, and client-side technologies. If you would like me to speak to your group, just drop me a line.