Doesn't matter. The argument is actually both already. If you
reference it without a scope, it's a local variable. If you reference
it with the 'arguments.' qualifier, it's an argument. And yes, there
really is two copies of the string accessible in your function.
That's also why you can't declare a local variable with the same name
as an argument: it's already declared implicitly by CF.
I personally NEVER use the arguments qualifier, thereby ensuring that
I'm always dealing with the local variables. It's easier to spot
"arguments." where it shouldn't be, than it is to spot a missing one.
You do have to use the arguments scope for structKeyExists calls for
non-required args that don't specify a default, but that's the only
place you need it, at least in my book.
cheers,
barneyb
On 6/7/05, Michael Dinowitz <[EMAIL PROTECTED]> wrote:
> I've got a function which takes in a string, runs it through a half dozen
> alterations and then returns the string. Currently I'm using a CFARGUMENT to
> accept/check/etc. the string and then each function works on that argument:
>
> //remove 8 or more quoted lines. a quoted line starts with a newline, has a >
> and goes on till a newline or a carriage return. Other quote delimiters are
> not taken into effect.
> arguments.localbody=REReplace(arguments.localbody,
> '[\n]+(>[^\n\r]*[\n\r]*){8,}', '', 'all');
>
> Now here's the question. Is it better style and/or performance wise to create
> a local variable to manipulate or to manipulate the argument directly?
--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/
Got Gmail? I have 50 invites.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:208857
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