You are mapping your personaly OO preferences onto CFML, when
unfortunately that boat has already sailed, and neither you, nor I, nor
Sean, nor obalobbingbong (my Susi Sorglos) were consulted. Tough shit. This
is not an option, so get it out of your head. Seriously: get it out of your
head, it is not an option.
Of course it is a option!
You are aware that this is not the first time i did a decision like this,
just a list (out of my head)
- don’t pass array by value
- don’t interpret variable keys
- handle this argument.key and arguments[“key”] the same way
- …
and of course there are a lot of settings in the admin where you can choose
to have a different behaviour, so in the end this is the same as this
option in admin, the default behaviour does not chane, but if you like to
do it different …
I think you have lost focus a little bit, we are not talking about removing
createObject, if you dont care about this new function don’t use them,
nobody is stopping you from using createObject.
No it’s not. You’re taking a dogmatic view of OO which is inappropriate
here. There is nothing saying an object can’t exist in two states: created
and initialised. It’s not something that other languages do, but it’s not
the only thing CFML does that isn’t the way that other languages do it, and
this does not intrinsically make it a problem. However there is no OO axiom
that prohibits this.
And if this would be a design choice of ACF i would even consider to agree
with you, i could say it was a bad decision but it was decided this way so
this is how cfml works. But this was never a design decision, when they
added the “new” operator they did simply not change the behaviour of
createObject. Adobe avoids to change existing behaviour at any coast, to
make it as easy as possible to update from one version to an other. What is
not always in the interest of the language.
If this would be a design choice they should make it possible to hook in
before the base constructor (component body) was executed, but please not a
process that stops halfway done nd you have to finish yourself.
My personal opinion always had influence on how things are done in
Railo/Lucee and that will not change.
Requirements:
** create a CFML object and have its init() called*
** the reference to the object might be a runtime value, presented as a
string (see createObject())*
** the existing approach using the new keyword is unacceptable*
** there are no backwards compat issues*
Given the requirements, how is it my mooted solution will not resolve the
problem in a CFML-friendly way?
It does, i never said that createObject cannot be used the right way and
getting a proper result in any case. That is not the point, the point is
that there is a right and a wrong way with createObject, the person that
does make the instance has to make sure that the instance is proper
instantiated, but this is not the job of the person that makes the
instance. This is a design flaw with createObject and because of that this
functionality is deprecated.
I’m sure that you still will disagree because this answer has nothing I
have not already written more than once but this is my position.
MichaOn Sat, Apr 18, 2015 at 11:59 PM, Adam Cameron <@Adam_Cameron> wrote:
On Saturday, 18 April 2015 22:38:24 UTC+1, Micha wrote:
I did, but try me to do it with other words
No you didn’t. I’m not sure you are yet, but I’ll respond anyhow.
if I make a init method that is private I expect that it is not possible
to create an instance from outside,
CFML treatment:
createObject(“Foo”) // uninitialised object.
createObject(“Foo”, args) // exception
if a make a init method with a required argument, I expect that it is
only possible to create a instance by passing that argument.
CFML treatment:
createObject(“Foo”) // uninitialised object.
createObject(“Foo”, argsWithoutReqd) // exception
If I have a init method I expect that it is executed, always independent
of the syntax I use!
NO.
This is not how CFML works.
It might be how other OO languages work, and that’s lovely. And CFML
perhaps ought to be that way (although I think Luis and Sean will
differ here), but it’s not.
You are mapping your personaly OO preferences onto CFML, when
unfortunately that boat has already sailed, and neither you, nor I, nor
Sean, nor obalobbingbong (my Susi Sorglos) were consulted. Tough shit. This
is not an option, so get it out of your head. Seriously: get it out of your
head, it is not an option.
If you like, make this a rule in .lucee, and do what you like. No one
gives a shit what you do there, so you can stamp yer foot and make your own
OO preferences that language’s particular dogma to your heart’s content.
However there’s over a decade’s worth of CFML code out there that doesn’t
work this way, so yer stuck with the way CFML works. You need to remember
you are not the steward of this language.
Also bear in mind that no-one is raising this as an issue that needs to be
“fixed”, so it’s beyond your remit to go ahead and “fix” it.
Everything else is a flaw in the design of the language.
No it’s not. You’re taking a dogmatic view of OO which is inappropriate
here. There is nothing saying an object can’t exist in two states: created
and initialised. It’s not something that other languages do, but it’s not
the only thing CFML does that isn’t the way that other languages do it, and
this does not intrinsically make it a problem. However there is no OO
axiom that prohibits this.
You are simply mapping your particular OO-interpretation preferences onto
a problem that doesn’t exist.
Because of that createObject(“susi”); Is bad and we cannot change it, the
only thing we can do is mark it as bad.
So hopefully I’m following your rules now …
No, because you’re still not answering the question, you’re still
inventing your own question and answering that.
The question - simplified - is:
Requirements:
- create a CFML object and have its init() called
- the reference to the object might be a runtime value, presented as a
string (see createObject())
- the existing approach using the new keyword is unacceptable
- there are no backwards compat issues
Given the requirements, how is it my mooted solution will not resolve the
problem in a CFML-friendly way?
Rules:
Just leave your rhetoric and your dogma out of it, Micha.
Just. Answer. The. Question.
–
Adam
–
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+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/lucee/40089b3b-2241-4a36-ab5f-17dcda35d593%40googlegroups.com
https://groups.google.com/d/msgid/lucee/40089b3b-2241-4a36-ab5f-17dcda35d593%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.