Skip to main content
Known Participant
January 12, 2011
Question

createObject() - first parameter default value?

  • January 12, 2011
  • 1 reply
  • 872 views

Hi all

I just wanted to know if someone from Adobe would be able to verfiy that the first parameter of createObject(), i.e. type is actually optional and will default to "component" if not supplied? It is not mentioned in the docs:

http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-697b.html

More info here: http://www.bennadel.com/blog/1957-CreateObject-In-ColdFusion-9-No-Longer-Requires-The-Type-Parameter.htm

This appears to be the case in CF 9 but I'm am a little unsure using non-documented behaviour in case Adobe 'fix' the problem in future.

Can anyone in a position of authority confirm this that type does default to component on purpose and it will not be changed in future?

Cheers

Ciaran

PS: If it does, that is great - it makes a lot of sense - but I want to be sure

    This topic has been closed for replies.

    1 reply

    Community Expert
    January 12, 2011

    There is no one in any position of authority who will guarantee that won't change in the future. That's just not how things work. This change isn't even in the formal documentation.

    If you're looking for an object instantiation syntax that will be guaranteed to work for components in the future, I'd recommend the "new" operator.

    Dave Watts, CTO, Fig Leaf Software

    http://www.figleaf.com/

    http://training.figleaf.com/

    Dave Watts, Eidolon LLC
    Known Participant
    January 13, 2011

    I guess I'm looking for someone to say: 'we just forgot to add it to the docs'

    I'm going to avoid it until I know for sure and use the new syntax as you suggest.

    Thanks.

    Inspiring
    January 13, 2011

    I am not officially from Adobe or anything, but I was on the official CF9 pre-release programme, and confirm that the omission of the requirement to specify "component" in createObject() calls is official and sanctioned CF9 syntax.

    Don't put too much stock in the docs: not a great deal of effort from Adobe goes into maintaining them, unfortunately.

    Adam Lehman (the ColdFusion Product Manager, or  something to that effect) has claimed - almost entirely without  real-world evidence, I hasten to add - that these forums are monitored by Adobe staff, so perhaps an official response to this could present itself, now that I have invoked his name...

    --

    Adam