----- Original Message ----- 
From: "reflexactions" <[EMAIL PROTECTED]>
To: <flexcoders@yahoogroups.com>
Sent: Thursday, December 20, 2007 2:51 PM
Subject: [flexcoders] Re: const?


> const are usually declared const becuase they are public or protected
> and accesible by other user or subclass and you wish to protect them
> with they const keyword so they cant be changed.

const isn't there for the explicit protection of class members, though const 
is often used to allow public access to class constants and it's used 
because they are constants not variables. const wasn't created for this 
specific scenario.

> Inside a function that is a few lines of code written by yourself you
> dont normally have a problem in having to protect yourself from
> assigning a value to a variable again unless you have a split
> personality.

That's me then. I consider it good practice and many others do so as well. 
If it's a constant unchanging value I'll declare it as a const and in 
capitals only.
The length of the function is immaterial - you are signalling the intended 
use to the developer and the compiler.

> Maybe you code like that all the time but I cant say I have seen that
> before...

Where have you been?

> If you dont understand the diference between class members and
> function vars well... not much I can say..

Well, you've interpreted my const comments as a lack of knowledge about 
classes. It doesn't say anything about me, because it's completely the wrong 
assumption.

Paul

> --- In flexcoders@yahoogroups.com, "Paul Andrews" <[EMAIL PROTECTED]> wrote:
>>
>> ----- Original Message ----- 
>> From: "reflexactions" <[EMAIL PROTECTED]>
>> To: <flexcoders@yahoogroups.com>
>> Sent: Thursday, December 20, 2007 1:41 PM
>> Subject: [flexcoders] Re: const?
>>
>>
>> > Thanks for the advice,
>> > Maybe you could read the question, I am talking about Adobe
> declaring
>> > a const inside a function and asking what is the use and benefit
> of
>> > that.
>>
>> What is so different about using const inside a function? Seems to
> me they
>> are just saying this value will not change after declaration. They
> are
>> simply saying this is not a variable, it will not be altered.
>>
>> This technique is often used for some special marker or value.
>>
>> I really don't see the relevance of whether it's inside an adobe
> function or
>> class, or anyone else's function or class.
>>
>> > No part of my question is covered by that help topic.
>>
>> I think it's all covered by that topic. What else is it that you
> are asking?
>>
>> Paul
>>
>> > --- In flexcoders@yahoogroups.com, "Paul Andrews" <paul@> wrote:
>> >>
>> >> Maybe you could help yourself?
>> >>
>> >> From the Flex 2 manual pages:
>> >>
>> >>
>> >
> http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwh
>> > elp.htm?
>> >
> context=LiveDocs_Book_Parts&file=03_Language_and_Syntax_160_13.html
>> >>
>> >> Constants
>> >> ActionScript 3.0 supports the const statement, which you can use
> to
>> > create
>> >> constants. Constants are properties with a fixed value that
> cannot
>> > be
>> >> altered. You can assign a value to a constant only once, and the
>> > assignment
>> >> must occur in close proximity to the declaration of the constant.
>> > For
>> >> example, if a constant is declared as a member of a class, you
> can
>> > assign a
>> >> value to that constant only as part of the declaration or inside
>> > the class
>> >> constructor. "
>> >>
>> >> Paul
>> >>
>> >>
>> >>
>> >> ----- Original Message ----- 
>> >> From: "johantrax" <johan.temmerman@>
>> >> To: <flexcoders@yahoogroups.com>
>> >> Sent: Thursday, December 20, 2007 12:14 PM
>> >> Subject: [flexcoders] Re: const?
>> >>
>> >>
>> >> > Then it's out of my league, perhaps someone from Adobe could
> help
>> > us
>> >> > out? (subtile hint ;)
>> >> >
>> >> >
>> >> > --- In flexcoders@yahoogroups.com, "reflexactions"
>> > <reflexactions@>
>> >> > wrote:
>> >> >>
>> >> >> Actually I wouldnt mind betting that code of yours would run
>> > without
>> >> >> any error at all, native types are passed by value not
> reference.
>> >> >>
>> >> >
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> > 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
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >
>> >
>> >
>> >
>> > --
>> > 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
>> >
>> >
>> >
>> >
>>
>
>
>
>
> --
> 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
>
>
>
> 

Reply via email to