Copy link to clipboard
Copied
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...
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
Copy link to clipboard
Copied
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/
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Thanks Adam
It's good to know even that! It's a shame the docs are not complete - they are, after all, an important learning tool.
Maybe we'll get the offical word here at some point - but in the meantime thanks for taking the time to reply.
Ciaran
Copy link to clipboard
Copied
I think Adam Cameron's response is as authoritative as you're likely to get.
That said, I'd recommend just using "new" anyway. If your goal is to have a syntax that you know will work in any subsequent version, "new" fits the bill. Plus, it's better syntax in my opinion.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/