>I can just dump that structure
good point

>var local = declare("filepath,filename,extension","string");
interesting idea....

-----Original Message-----
From: S.Isaac Dealey [mailto:[EMAIL PROTECTED]
Sent: 05 April 2005 17:52
To: CF-Talk
Subject: Re: var groups


> hey, just a thought while I am var ing about 20 variables
> for a large
> function:

> Anyone know if MM have looked at/dismissed the idea of
> multiple vars i.e.

> var filepath,filename,extension as String;
> var linesread,lineswritten,timeout as Int;

> ?

Seems to me like that would be against the grain of CFML being a
weakly typed or "untyped" language, since there isn't any "int" or
"String" data type... Though it wouldn't be difficult at all to
produce this sort of thing on your own...

function declare(list,type) {
        var x = 0;
        var v = structnew();
        if (arraylen(arguments) gt
        2 and isstruct(arguments[3])
                { v = arguments[3] }
        list = listtoarray(list);
        for (x = 1; x lte arraylen(list); x = x + 1) {
                switch (type) {
                        case "string": { v[list[x]] = ""; break; }
                        case "int": { v[list[x]] = 0; break; }
                        case "struct" { v[list[x]] = structnew(); break; }
                }
        }
        return v;
}

function somethingElsxe() {
        var local = declare("filepath,filename,extension","string");
        declare("linesread,lineswritten,timeout","int");
}

Granted, it does require you to place the variables in a var'ed local
structure, though personally I don't see that as any disadvantage. I'm
in the habbit of putting function variables in a structure anyway,
that way I only have to var the structure, and if I need to see what's
in the structure at any given time I can just dump that structure,
which isn't readily available with individually var'ed variables.

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://macromedia.breezecentral.com/p49777853/
http://www.sys-con.com/author/?id=4806
http://www.fusiontap.com




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:201485
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

Reply via email to