--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/d1b01e3a-13c9-4fd5-83bb-347f72a42fe1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
|
|
CONFIDENTIAL AND PRIVILEGED - This e-mail and any attachment is intended solely for the addressee, is strictly confidential and may also be subject to legal, professional or other privilege or may be protected by work product immunity or other legal rules. If you are not the addressee please do not read, print, re-transmit, store or act in reliance on it or any attachments. Instead, please email it back to the sender and then immediately permanently delete it. Pixl8 Interactive Ltd Registered in England. Registered number: 04336501. Registered office: 8 Spur Road, Cosham, Portsmouth, Hampshire, PO6 3EB |
I would say that you should always return 'this' in the init() method, not doing so will cause confusion at best and problems at worst. Though I'd be curious to know what the reason for not returning 'this' is?
component{
variables.blah = "test";
function init(required numeric bar, array baz){
variables.bar = bar;
variables.bazlen = baz.len();
return THIS; //required in Lucee - while ACF returns this if nothing else is returned
}
array function something(){}
}
new Foo( 1, [a,b,c] )
createObject("component").init( 1, [a,b,c] );
createObject("component");
component{
array function init(required numeric bar, array baz){
return baz;
}
}
component{
package function init(required numeric bar, array baz){
return this;
}
}
new other.package.Foo()
component extends="Bar" {
}
Depends on how you create your instances - new Foo(), createObject("componen", "Foo).init(), <cfobject...> and <cfinvoke...> have different behaviour. Which way do you use?
On Friday, 27 March 2015 11:30:46 UTC, Walter Seethaler wrote:Depends on how you create your instances - new Foo(), createObject("componen", "Foo).init(), <cfobject...> and <cfinvoke...> have different behaviour. Which way do you use?That's kinda comparing apples to oranges to pears.In your comparsion between createObject() and <cfobject>, with createObject() you're chaining a call to init(). If one was to remove the explicit call to init(), do createObject() and <cfobject> differ?And <cfinvoke> isn't designed for creating objects, it's designed for executing methods. So not a valid comparison I think. That said, if you call init() with <cfinvoke>, does it behave any different to createObject().init() ?
> The main reason is that CF was not designed as an OO language.Well the bits of CFML you're discussing here were designed to be OO. The problem is that the design was a bit rubbish.
--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/b04626ef-5457-46aa-846e-57dc3a0bfd27%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/ae68639c-4081-400d-a597-9caa626d379e%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/02a6e348-42c8-4217-bc9a-85539315ee7a%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.