>
>Of course, in the long run, it really doesn't matter, as long as we know
>what behavior to expect. However, there are useful benefits to passing
>structures by reference to custom tags. For example, let's say we wanted to
>filter input. Ideally, we could use an external component for that, since
>CF's string handling doesn't seem to be as fast as we'd like it to be, but
>the CFX interface doesn't support that, as far as I can tell. We could,
>however, build a custom tag that accepts one or more  structures as
>attributes, and makes changes to those structures' contents.
>

Another important point is the amount of data being pushed around
on the server. If you had to create a complex data structure and then
copy the entire data structure just to modify the structure and then
return that copy it would be terribly inefficient.

If you pass a reference then you can modify the structure quickly
and efficiently. There are a myriad of benefits for passing around
references to complex data types.

I would caution against using references to basic data types. If
you were to pass a reference, if you even could, to a function
that only used basic data types it would create a situation where
it becomes less than clear and the function is stepping outside
of its "box" and modifying the world around it.

I like  the way PHP handles references. In PHP each variable is
like a "file" and each reference to it a symbolic link. So if a
reference to a reference is created the reference really
references the real variable, say that ten times fast.
You have to choose whether or not to pass by copy or reference.
This can be done via the function definition or the function call,
anyhow I digress.


Jeremy Allen
elliptIQ Inc.
--
http://www.neighborware.com
America's Leading Community Network Software
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to