CreateObject("component","x.y.z")
Considering that the vast majority of CFML developers will always be
doing a component, i am thinking that we should just default the
"component" bit.
So i am proposing this small addition:
CreateObject("x.y.z")
Thoughts?
--
aw2.0
http://www.aw20.co.uk/
Andy
--
aw2.0
http://www.aw20.co.uk/
So i am proposing this small addition:
CreateObject("x.y.z")
--
CFML Conventional Wisdom
http://groups.google.com/group/cfml-conventional-wisdom?hl=en?hl=en
To unsubscribe from this group, send email to cfml-conventional-wisdom+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Given that this is (almost) how CF9 does things, I can't see any
reason to change createObject() rather than just add the 'new'
operator.
> <cfset myObj = new com.maepub.project.User(someParam) />
>
> Or a no argument init would look like this:
>
> <cfset myObj = new com.maepub.project.User() />
This is exactly how CF9 does it (and how Railo will soon).
You can also do:
import com.maepub.project.User;
myObj = new User();
or
import com.maepub.project.*;
myObj = new User();
(This was also what the CFML Advisory Committee agreed on)
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies US -- http://getrailo.com/
An Architect's View -- http://corfield.org/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
import com.maepub.project.*;
myObj = new User();
(This was also what the CFML Advisory Committee agreed on)
does this imply that the User object has an "init" function somewhere?
do then assume that "init" is the default/unofficial/official object
constructor?
That won't be a major problem to support in OpenBD (says he, looking at
Andy hoping not to see daggers!)
I honestly don't think there is anyone that is actually designing
this within Adobe. If there was, then half of the implementations
would never have made it past any sane discussions.
So many inconsistencies, i don't get surprised anymore.
+1 to the "new XYZ()" operator.
On Sun, Mar 21, 2010 at 11:39 AM, Sean Corfield <seanco...@gmail.com> wrote:
import com.maepub.project.*;
myObj = new User();
(This was also what the CFML Advisory Committee agreed on)
I'm a big fan of this, Java-esque as it is. Makes it all the more curious that this is what they went with in CF 9 since there's so much "if you want Java, use Java" sentiment elsewhere in the syntax discussions.
com.my.namespace.classname.method();
instead
c = createObject("component","com.my.namespace.classname");
c.method();
The way it is done now it total waste of time and space.
Best Regards,
Marko Simic
It will call init() it if is defined. CF9 added at least one other way
to specify a method as a constructor, I believe, but adopted the
widely used convention that init() 'is' the constructor.
Bear in mind also that when you interact with a Java object, you must
call init() in order to invoke the constructor:
s = createObject( 'java', 'java.lang.String' ).init( 'hello' );
// equivalent of new String( 'hello' )
Aiming to have it supported in OpenBD this week.
Andy
Aiming to have it supported in OpenBD this week.
.pjf