>> There are some array functions you can use on Arguments
>> in MX but not all -- as a matter of fact, there are array
>> functions which could be used on the Arguments array in
>> CF 5 that now can't be used on them in MX (imho this is a
>> bug), for instance, you can't use arrayprepend,
>> arrayappend
>> or arrayinsertat on an array in CFMX (which I had been
>> using for several wrapper functions until I realized they
>> didn't work in MX). But ArrayLen() still works.

> I'm not sure I understand. I've successfully used
> ArrayAppend on arrays in
> CFMX - this is part of the Advanced CF Development course
> curriculum, so I'm
> pretty sure that it works. I haven't tried to use these
> functions on the
> Arguments array, but I wouldn't expect them to work there
> - it seems that
> the Arguments scope should logically be read-only to me.

The array wasn't read-only in CF 5 (and isn't read-only in CF MX) -- in CF 5
it worked much the way the arguments array works in JavaScript -- which I
thought was really useful, because it meant I could create wrapper functions
real easily, for instance, from my open-source API:

function jsexpand(element) {
        arrayinsertat(arguments,2,"style.display");
        arrayinsertat(arguments,3,"block");

        return request.tapi.call("request.tapi.js.setDOM",arguments);
}

The function being called (request.tapi.js.setDOM) at the end has a 4th
argument called window which defaults to "window" -- it's optional and
doesn't appear in the arguments list for the function because
request.tapi.js.setDOM creates a default for it, so if I created a default
for is in the js.expand function, I would then have to change the default
for js.expand if I were to change the default for js.setDOM.

Now that I can no longer do this (arrayinsertat(arguments,x,y)) in MX, the
process becomes more complicated and the end result is that the above
becomes more code and slower to process using the following for MX
compatibility:

function jsexpand(element) {
        var x = 1;
        var args = arraynew(1);

        for (x = 1; x lte arraylen(arguments); x = x + 1)
                { arrayappend(args,arguments[x]); }

        arrayinsertat(args,2,"style.display");
        arrayinsertat(args,3,"block");

        return request.tapi.call("request.tapi.js.setDOM",args);
}

I can understand the idea behind saying that the arguments array ought to be
read-only, but I don't agree with it. My functions in most cases aren't very
large, and if I needed for some reason to remember what the original
arguments were (which I can't imagine why I would need to, but it could
happen) then I could just use <cfset duplicate(arguments)> at the top of the
function. I can't do this with MX as a workaround for the above problem
however, because the duplicated object would also not be an array and
therefore also not allow the arrayinsertat() function to be used on it.

s. isaac dealey                954-776-0046

new epoch                      http://www.turnkey.to

lead architect, tapestry cms   http://products.turnkey.to

tapestry api is opensource     http://www.turnkey.to/tapi

certified advanced coldfusion 5 developer
http://www.macromedia.com/v1/handlers/index.cfm?ID=21816

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to