On Tue, Oct 30, 2001 at 09:59:49AM +1100, Damian Conway wrote:
> 
>    > >         class Demo {
>    > >                 my $threshold is const = 100;
>    > 
>    > Hmm... is a "my const" the same as an "our const"?
> 
> No. 'my' is per-instance; 'our' is per-class.

But, in terms of constants, it seems to me that there's no
difference. They both have only one value that is assigned
when the module/class is parsed.

>    >    class Demo {
>    >            my $id is immutable;
>    >            method INIT ($demo_id is initializer ($id)) {}
>    > 
>    > "is initializer" is rather long, but you get the idea.
> 
> I'd do that like so (using Larry's preferred syntax):
[...]
>         method INIT ($idval) { $.id := $idval }

Hm... that looks to me like a regular ":="; is it?

If so, what good is "is const" if you can override it with
a ":="? Am I missing something?

-- 
Aaron Sherman
[EMAIL PROTECTED]             finger [EMAIL PROTECTED] for GPG info. Fingerprint:
www.ajs.com/~ajs        6DC1 F67A B9FB 2FBA D04C  619E FC35 5713 2676 CEAF
  "Write your letters in the sand for the day I'll take your hand
   In the land that our grandchildren knew." -Queen/_'39_

Reply via email to