[cfaussie] Re: Varscoping and CF9
I'm interested in your approach. Given that variables scope is object- scoped, do you have a method such as getCountVars in each class, then iterate over your singletons, asking each one for how many vars it has? Got any code to share? On Oct 4, 12:01 pm, MrBuzzy mrbu...@gmail.com wrote: Saw your post on stack over flow toohttp://bit.ly/qBVajq:) We've got a different var scoper, it doesn't scan code, instead it works at runtime to count the variables and decide if the variables scope has grown when a cffunction is run. I haven't tried it, but I suspect this approach would work for cfscript, with the caveats of some runtime overhead and the need to add some code to each function :( On 04/10/2011, at 10:09 AM, Dave dave1...@gmail.com wrote: I've noticed on a few of the CF Groups, people are posing all cfScript code, eg, all Property, Component and Function tags now written in script. What are people who are doing this using for var scoping of code? Mike's varscoper won't work with this sort of code. Dave -- You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/cfaussie?hl=en. -- You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.
[cfaussie] Re: Varscoping and CF9
Sean, Agreed it's much easier and I'm quite liking to new var-declaring rules. I'm kind of surprised that Adode hasn't come up with a solution (built into the compiler), given that the consequences for getting it wrong are so grave and they have put a lot of time and effort into making cfscript fully baked into the language. dave On Oct 4, 11:48 am, Sean Corfield seancorfi...@gmail.com wrote: On Mon, Oct 3, 2011 at 4:09 PM, Dave dave1...@gmail.com wrote: What are people who are doing this using for var scoping of code? Given that you can declare the var at the point of first use now, it's a lot easier to get it right: var n = arraylen(foo); for ( var i = 1; i = n; ++i ) { ... } for ( var key in myStruct ) { ... myStruct[key] ... } for ( var elem in myArray ) { ... elem ... } Also, in ACF at least**, the tags that populate variables (cfquery, cfhttp etc) don't have script versions so the common error of forgetting to var them is reduced. **Railo has script versions of query, http etc so you need to remember to var declare the result variables there. -- Sean A Corfield -- (904) 302-SEAN An Architect's View --http://corfield.org/ World Singles, LLC. --http://worldsingles.com/ Railo Technologies, Inc. --http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.
Re: [cfaussie] Re: Varscoping and CF9
Can't share the code sorry. It's nothing too magical. We use a custom tag, with a start and end tag. The tag wraps the body of the cf function. The tag test the length of the variables scope at the start and end of the tag. I probably shouldn't be recommending it. It's probably an anti-pattern or something ;) Sent from my iPhone On 04/10/2011, at 12:13 PM, Dave dave1...@gmail.com wrote: I'm interested in your approach. Given that variables scope is object- scoped, do you have a method such as getCountVars in each class, then iterate over your singletons, asking each one for how many vars it has? Got any code to share? On Oct 4, 12:01 pm, MrBuzzy mrbu...@gmail.com wrote: Saw your post on stack over flow toohttp://bit.ly/qBVajq:) We've got a different var scoper, it doesn't scan code, instead it works at runtime to count the variables and decide if the variables scope has grown when a cffunction is run. I haven't tried it, but I suspect this approach would work for cfscript, with the caveats of some runtime overhead and the need to add some code to each function :( On 04/10/2011, at 10:09 AM, Dave dave1...@gmail.com wrote: I've noticed on a few of the CF Groups, people are posing all cfScript code, eg, all Property, Component and Function tags now written in script. What are people who are doing this using for var scoping of code? Mike's varscoper won't work with this sort of code. Dave -- You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/cfaussie?hl=en. -- You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en. -- You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.
Re: [cfaussie] Re: Varscoping and CF9
On Mon, Oct 3, 2011 at 6:22 PM, MrBuzzy mrbu...@gmail.com wrote: We use a custom tag, with a start and end tag. Might be hard to run a custom tag in cfscript... :) -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.
Re: [cfaussie] Re: Varscoping and CF9
Sean should be able to whip up some clojure code that does it in a flash :) Sent from my mobile On 04/10/2011, at 12:56 PM, Sean Corfield seancorfi...@gmail.com wrote: On Mon, Oct 3, 2011 at 6:22 PM, MrBuzzy mrbu...@gmail.com wrote: We use a custom tag, with a start and end tag. Might be hard to run a custom tag in cfscript... :) -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en. -- You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.
Re: [cfaussie] Re: Varscoping and CF9
Yeah, what he said ;) Sent from my iPhone On 04/10/2011, at 12:59 PM, Andrew Myers am2...@gmail.com wrote: Sean should be able to whip up some clojure code that does it in a flash :) Sent from my mobile On 04/10/2011, at 12:56 PM, Sean Corfield seancorfi...@gmail.com wrote: On Mon, Oct 3, 2011 at 6:22 PM, MrBuzzy mrbu...@gmail.com wrote: We use a custom tag, with a start and end tag. Might be hard to run a custom tag in cfscript... :) -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en. -- You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en. -- You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.
Re: [cfaussie] Re: Varscoping and CF9
On Mon, Oct 3, 2011 at 6:59 PM, Andrew Myers am2...@gmail.com wrote: Sean should be able to whip up some clojure code that does it in a flash :) Heh, one of the reasons I like Clojure is that it's thread safe by design since data is immutable by default and any mutability is managed thru STM (Software Transaction Memory - which is a bit like database transactions). -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ World Singles, LLC. -- http://worldsingles.com/ Railo Technologies, Inc. -- http://www.getrailo.com/ Perfection is the enemy of the good. -- Gustave Flaubert, French realist novelist (1821-1880) -- You received this message because you are subscribed to the Google Groups cfaussie group. To post to this group, send email to cfaussie@googlegroups.com. To unsubscribe from this group, send email to cfaussie+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.