deactivateduser
02/25/2022, 4:40 PMDavid Rogers
02/25/2022, 5:00 PMelpete
02/25/2022, 5:05 PMduplicate( obj, false )
which does a shallow copy. https://docs.lucee.org/reference/functions/duplicate.htmldeactivateduser
02/25/2022, 5:08 PMDavid Rogers
02/25/2022, 5:11 PMc.getBar() !== c_dup.getBar()
c.getFoo() === c_dup.getFoo()
component /*A*/ { property foo inject='somesingleton'; }
component /*B*/ extends=A { property bar inject='statefulInstance'; }
component /*C*/ extends=B { property baz inject='statefulInstance2'; }
c = getInstance("C")
c_dup = duplicate(c, false); // c.getBar() !== c_dup.getBar() ?
deactivateduser
02/25/2022, 5:17 PMdeactivateduser
02/25/2022, 5:18 PMsknowlton
02/25/2022, 5:19 PMduplicate()
is also dangerous in Lucee due to an ORM bug from forever ago that can cause funky things with Hibernate sessions even if your code isn't touching Hibernatedeactivateduser
02/25/2022, 5:28 PMDavid Rogers
02/25/2022, 5:31 PMcomponent /*A*/ singleton {}
v = getInstance("A")
v._magic_isSingleton() // is this possible
deactivateduser
02/25/2022, 5:35 PMDavid Rogers
02/25/2022, 5:36 PMasSingleton
deactivateduser
02/25/2022, 5:37 PMbdw429s
02/25/2022, 7:05 PMthe instance will maintain state that needs to be separate from other instancesThat's not a singleton 🙂
David Rogers
02/25/2022, 7:05 PMbdw429s
02/25/2022, 7:06 PMgetInstance( 'myMappingName' )
, then it's possible to look up whether or not that mapping was a singleton inside WireBox's binder where the mappings are stored.bdw429s
02/25/2022, 7:07 PMbdw429s
02/25/2022, 7:07 PMbdw429s
02/25/2022, 7:08 PMbdw429s
02/25/2022, 7:08 PMbdw429s
02/25/2022, 7:13 PMbdw429s
02/25/2022, 7:13 PMjclausen
02/25/2022, 8:02 PM