Steve Lukas writes:

> (1) The best readable form is probably:
> readonly $temperature; # lexical scope
> (2) But this fits better in perl6 conventions:
> my $temperature is ro; # lexical scope
> I think form (2) should be possible for variables.

As Larry's pointed out, it pretty much already is.

> And form (1) C<readonly $temperature;> should become syntactical sugar
> for C<my $temperature is ro;>

Why?  What does hiding the fact that is a lexical variable declared with
C<my> get us?  Isn't your form 2 sufficient?

> (3) For those who work a lot with readonly semantics, this could be
> best: readonly $-temperature; # lexical scope, twigil prevents all
> attempts!

I don't fully understand.  In what way are you proposing:

  readonly $-temperature = value();

would differ from:

  readonly $temperature = value();

?  Are you envisaging that both forms would be permitted, such that a
program could have some read-only variables with minus signs and some
without them?

Would the form with the minus sign require the minus sign every time the
variable is referred to (that is, it is part of its name)?  If so, do
you really think that C<$-temperature> looks 'more' read-only than
C<$TEMPERATURE> does?  Would you also be able to declare a separate
(presumably read-write) variable, C<$temperature> in the same scope as


Reply via email to