> How about just an Array CFC that has an internal array
> variable.
> Since it's the CFC being passed, you get the
> pass-by-reference. You
> could build whatever extra methods you wanted on it as
> well as the
> required accessor/modifier methods. Basically you'd be
> rewriting
> java.util.Vector with a CFC so that CF won't clone it all
> over the
> place like it does with real Vectors.
> cheers,
> barneyb
That's possible... Not what I had in mind, but it's possible... It
doesn't encapsulate the instructions the way I was imagining. Here's a
crude example (pardon the lack of appropriate i18n, etc.):
<cfset item = session.cart.getHeadItem()>
<cfloop condition="isObject(item)">
<tr>
<td>#item.getName()#</td>
<td>#item.getQty()#</td>
<td>$#item.getPrice()#</td>
<td>$#item.getSubtotal()#</td>
</tr>
<cfset item = item.getNextItem()>
</cfloop>
comparable array version
<cfloop index="x" from="1" to="#arraylen(session.cart)#">
<cfset item = session.cart[x]>
<tr>
<td>#item.getName()#</td>
<td>#item.getQty()#</td>
<td>$#item.getPrice()#</td>
<td>$#item.getSubtotal()#</td>
</tr>
</cfloop>
I'm not sure if this makes any sense, but I kinda like the
encapsulation of the former -- it seems cleaner to me... Even if I
wrapped the latter in a separate CFC to manage a java Vector I still
wouldn't get that same kind of encapsulation.
s. isaac dealey 954.522.6080
new epoch : isn't it time for a change?
add features without fixtures with
the onTap open source framework
http://www.fusiontap.com
http://coldfusion.sys-con.com/author/4806Dealey.htm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:218076
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54