----- Original Message ----- From: "reflexactions" <[EMAIL PROTECTED]> To: <flexcoders@yahoogroups.com> Sent: Thursday, December 20, 2007 3:21 PM Subject: [flexcoders] Re: const?
>I work in a team and have so done for the last 20+ years and never > yet declared a variable with function level scope as const just to > prevent some other person coming along later and changing the code > value of the variable if they think it is needed. 20+ years? LOL, I have the drop on you.. It's not just 'for some other person', it would be for the original developer too. > ...and if thats was the case why dont we see widespread use of this > style within Adobe code... Bad practice? I haven't gone looking through the adobe code to root this out. > If I need something like pi as a const I would declare a class member > const for pi, not a function scoped const var. Depends if you intend to use the constant outside the function. If it should be accessible outside the function, it should be a class constant, as you say. > But seems you guys program different from the way we do I guess, Yes, but why wouldn't you declare a value intended to be used as a constant, as const? Paul > --- In flexcoders@yahoogroups.com, "johantrax" <[EMAIL PROTECTED]> > wrote: >> >> > unless you have a split personality. >> >> Well... it might be you just provided the answer there. When working >> on a project having the size of Flex, you work in a team. >> Most probably a short function is indeed written by one person. But >> what guarantees that nobody else will one day pass by and alter your >> functions? In the case of shared work, defining that variable as a >> const is a much quicker way of telling others that it's a >> marker/whatever, than having to put comment out there, saying: >> //next is a variable >> //I pray to you and the lord to not change it >> // because it just holds some value I need to remember >> var pleaseDoNotChangeMe:Number = 3.1415...; >> // End of Prayer ;) >> >> --Johan >> > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > >