Always the exception ;)  I must admit that this is definitely one place I
don't mind letting my team cheat.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Barney Boisvert
Sent: Tuesday, February 10, 2004 11:45 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] How should I define variable in a CFC?

You've got a very valid point, with one exception: "throwaway" looping
variables, particularly of the array index variety.  Those variables are
always a pain in the ass to deal with, particularly if you have to
predeclare them.  And it's even worse in CF, because you don't HAVE to
predeclare them, so you can get the most annoying bugs.

Things would be much better if we could have "block-scoped" variables (like
in C or Java), as well as "function-scoped", because then the looping
variables could be AUTOMATICALLY made block scope, with the need to
predeclare them if you want to use them after the loop is complete.  Not
sure how that would work in non-function situations, but perhaps that
behaviour could only be bound to within-function situations.  Not like we
don't already have all kinds of screwed up scope rules regarding functions.

Cheers,
barneyb

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Roland Collins
> Sent: Tuesday, February 10, 2004 8:30 PM
> To: [EMAIL PROTECTED]
> Subject: RE: [CFCDev] How should I define variable in a CFC?
> 
> In the case of an "un-typed" language (or pseudo-typed as CF 
> tends to be),
> you are correct.  I was speaking more from a conceptual 
> standpoint . . .
> I've generally found it better to declare variables up front, even in
> languages that support late-binding or just-in-time 
> declaration.  Underneath
> the hood, I doubt it really matters today, with most 
> compilers performing
> the same optimizations regardless of where you put your 
> declarations.  It
> does however enforce a discipline to coding that I believe provides a
> benefit in terms of code clarity, and it forces developers to 
> think through
> a function from start to finish instead of the "code as you 
> go" method of
> programming.
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf
> Of Matt Liotta
> Sent: Tuesday, February 10, 2004 10:18 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [CFCDev] How should I define variable in a CFC?
> 
> I don't really see how that is an "acquire early" method of memory 
> allocation as the suggestion is to "var" an empty string and 
> then later 
> turn it into a struct, which means the memory for the struct is still 
> allocated at the same time. I'm not really worried about memory 
> allocation though. I just find it messy to declare variables that I 
> might not use at runtime. Maybe it is a holdover from my C days, but 
> nevertheless that is how I feel.
> 
> -Matt
> 
> 
> On Feb 10, 2004, at 10:09 PM, Roland Collins wrote:
> 
> > I've always been a proponent of the "acquire early" method of memory
> > allocation, which is essentially what the up-front "var" 
> requirements 
> > are
> > enforcing.  For one, it greatly helps with code-readability 
> and forces 
> > you
> > to think through what really needs to be in a given function.  If 
> > you're
> > getting into logic that sometimes requires a large memory 
> segment (or
> > complex variable) and sometimes doesn't, then the argument could be 
> > made
> > that the code could use some refactoring.  Most of the 
> time, however, 
> > a temp
> > variable is so small as to be insignificant if it's not 
> used, so it's 
> > not
> > worth worrying about.
> >
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
> > Behalf
> > Of Matt Liotta
> > Sent: Tuesday, February 10, 2004 9:35 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [CFCDev] How should I define variable in a CFC?
> >
> >> What am I missing about why it's a problem?
> >>
> > Again, its messy since you have to define all these different names
> > upfront for branch logic that might not ever require them. 
> I never said
> > it couldn't be dealt with; I just don't like how you have 
> to deal with
> > it.
> >
> > -Matt
> >
> > ----------------------------------------------------------
> > You are subscribed to cfcdev. To unsubscribe, send an email
> > to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> > in the message of the email.
> >
> > CFCDev is run by CFCZone (www.cfczone.org) and supported
> > by Mindtool, Corporation (www.mindtool.com).
> >
> > An archive of the CFCDev list is available at
> > www.mail-archive.com/[EMAIL PROTECTED]
> >
> >
> > ----------------------------------------------------------
> > You are subscribed to cfcdev. To unsubscribe, send an email
> > to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
> > in the message of the email.
> >
> > CFCDev is run by CFCZone (www.cfczone.org) and supported
> > by Mindtool, Corporation (www.mindtool.com).
> >
> > An archive of the CFCDev list is available at 
> > www.mail-archive.com/[EMAIL PROTECTED]
> >
> 
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
> in the message of the email.
> 
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
> 
> An archive of the CFCDev list is available at
> www.mail-archive.com/[EMAIL PROTECTED]
> 
> 
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
> in the message of the email.
> 
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
> 
> An archive of the CFCDev list is available at 
> www.mail-archive.com/[EMAIL PROTECTED]
> 

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

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


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

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

Reply via email to