i like the fact you don't need to think of the data type of the object
when looping around. that is a really nice addition.
or maybe just: <cffor> .. </cffor>
Matthew Woodward wrote:
> On Sun, Feb 21, 2010 at 7:16 AM, Alan Williamson <al...@aw20.co.uk
> <mailto:al...@aw20.co.uk>> wrote:
>
> i was thinking about this in the plane yesterday ... how about a new
> tag for this:
>
> <cfforeach element="" object="">
> </cfforeach>
>
> i am not sold on the "object" parameter name.
>
>
> I like it! Maybe "var" instead of "object" for consistency with a couple
> of other tags?
"var" !!! of course! doh! yes. much better.
i like the fact you don't need to think of the data type of the object when looping around. that is a really nice addition.
or maybe just: <cffor> .. </cffor>
1. a new tag to illustrate the power of this type-less looping
_or_
2. add each/in attributes to CFLOOP instead of creating more tags?
i am favouring Option#2 here, but only 60% / 40%. Interesting to see
what others think.
i am favouring Option#2 here, but only 60% / 40%. Interesting to see what others think.
The only advantage to having a new tag is that you can ignore
backwards compatibility for the attributes. Beyond that, having
<cfloop> AND <cfforeach> is silly. I especially dislike <cffor>
because the most common use of for statements is a simple numeric
incrementing loop, which IS <cfloop from="" to="" index="">.
Wait.. isn't foreach effectively <cfloop collection="blah"> ? I know
that doesn't handle all datatypes at the moment.
Wait.. isn't foreach effectively <cfloop collection="blah"> ? I know
that doesn't handle all datatypes at the moment.
you are right Mark, that could be overloaded to use other data types
too. i fear that would break too much backward compatibility.
One reason for perhaps preferring <cffor>: it matches cfscript:
for ( key in collection ) { ... }
for ( i = 1; i <= n; ++i ) { ... }
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies US -- http://getrailo.com/
An Architect's View -- http://corfield.org/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood