Hey Barney...

I'd say that it's because of CF's innate typelessness... since it sees all values, basically (and oversimplified), as a string, we can pretty well assume that the parser isn't coded to view "$" as a symbol of any kind. In other worse, since it's not specifically marked as a reserved symbol, it's not going to throw an error in the parser.

I, personally, don't like it either... it reminds me of variables in the old Commodore 64 code... it was a marker of a certain type that I can't recall now since the last time I used it was 20 years ago. But, $myVar was different than myVar, somehow.

In any case, I really don't like the idea of the var-scoped struct for all local variables inside a struct. I vastly prefer a series of var-local declarations at the top of my functions. It's cleaner, elminates a whole lot of extra stringage later in the function, it makes the whole deal a LOT more readable, and it's in keeping with normal coding practices outside the cffunction tag.

So... I don't like it. :) Sorry Paul... I don't like it at all. Not that this means you SHOULDN'T use it... except that once the CF team at MM finds out that the parser needs to catch currency symbols as non-alpha characters all the code you've based on this will most likely break.

Bad idea.

Laterz,
J

On 7/5/05, Barney Boisvert <[EMAIL PROTECTED]> wrote:
Because it looks nasty, and is probably only allowed due to some
weirdness in the CFML parser, and could well break in a future version
of CF.  CF variables must start with a letter, and contain only
letters, numbers and the underscore, which is a definition that "$"
doesn't meet. So the fact that it works is due to buggy (or at least
undocumented) behaviour.

cheers,
barneyb

On 7/5/05, Paul Roe <[EMAIL PROTECTED] > wrote:
> so forever i have been doing the following to make sure that I scope
> local vars in my functions in my cfc's:
>
> <cfset var lcl = StructNew() />
> <cfset lcl.end = 10 />
> <cfloop from="1" to="#lcl.end#" index="lcl.i">
> etc....
>
> While playing around today i noticed that the following also works:
>
> <cfset var $ = StructNew() />
> <cfset $.end = 10 />
> <cfloop from="1" to="#$.end#" index="$.i">
>
> Can anyone see a good reason why I shouldn't use the $ to denote
> locally scoped variables in functions?
>

--
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]





--
---------------
-------------------------------------
Buy SQLSurveyor!
http://www.web-relevant.com/sqlsurveyor
Never make your developers open Enterprise Manager again. ----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

CFCDev is supported by New Atlanta, makers of BlueDragon
http://www.newatlanta.com/products/bluedragon/index.cfm

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to