DW, ok thank you! Matthew, but saying that the M2 components are singletons in the Application scope is further evidence that everything -in- those components should very much be var scoped, and I think that the statement "so each thread has it's own instance" is false because these are singletons.
I appreciate the input guys, though I am no 100% convinced. I guess a simple test case would prove once and for all. Here is what I did. <cfset MACHII_CONFIG_MODE = -1 /> In my view, I have <cfset myvar = RandRange(1,100)> <cfset sleep(5000)> #myvar# I started one page thread, as it was running (sleeping) I started the other. If var scoping would have been required, then I think that the final outputted values should have been identical on both requests (race condition) but in fact, the values were different. So, it looks like you guys are correct, and var scoping is NOT required in your views. Thanks! Helps me sleep a bit better. -Brian On Dec 13, 4:38 pm, Matthew <[email protected]> wrote: > Hi Brian > > I'm pretty sure that there is no need to var scope because everything > in your view is treated as Request scope. You are right that M2 > includes the view from within a component however the component is a > Singleton in the Application scope, so each thread has it's own > instance therefore everything is in the Request scope. > > Cheers > Matthew > > On Dec 12, 7:22 pm, "Brian H." <[email protected]> wrote: > > > Hey Folks. > > > I've been using the local (var) scope in all of my components, but not > > in my views as I've always associated CFMs with single-theaded > > execution, but it just occurred to me that the view CFM files are > > cfincluded by persistent objects (the M2 framework) and probably > > require var scoping too! > > > If so, then I am a dummy and I have to revisit some of my sites. Can > > anyone confirm that we indeed need to var scope all of our variables > > inside of our views? > > > Thanks! > > > -Brian -- You received this message because you are subscribed to Mach-II for CFML list. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/mach-ii-for-coldfusion?hl=en SVN: http://greatbiztoolsllc.svn.cvsdude.com/mach-ii/ Wiki / Documentation / Tickets: http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/
