They do not refer to the same instance of the object. Actually, I would have expected the duplicate() obj to possible fail however I don't know what arraycontains() uses behind the scenes off hand for comparisons. On Aug 23, 2012 7:25 PM, "Adam Cameron" <[email protected]> wrote:
> G'day > This is just an FYI. I've just raised > http://code.google.com/p/openbluedragon/issues/detail?id=487. Detail: > > <cfscript> > o = new Object("value"); > a = [o]; > > writeOutput("Same object: " & arrayContains(a, o) & "<br />"); > writeOutput("Duplicated object: " & arrayContains(a, duplicate(o)) & > "<br />"); > writeOutput("New object inline: " & arrayContains(a, new > Object("value")) & "<br />"); > o2 = new Object("value"); > writeOutput("New object via variable: " & arrayContains(a, o2) & "<br > />"); > </cfscript> > > <!--- Object.cfc ---> > <cfcomponent> > <cfscript> > public Object function init(value){ > variables.value = arguments.value; > this.value = variables.value; > > return this; > } > </cfscript> > </cfcomponent> > > Output: > Same object: YES > Duplicated object: YES > New object inline: NO > New object via variable: NO > > All should return "YES", I think..? > > -- > Adam > > > -- > online documentation: http://openbd.org/manual/ > http://groups.google.com/group/openbd?hl=en > -- online documentation: http://openbd.org/manual/ http://groups.google.com/group/openbd?hl=en
