On Thu, 1 Nov 2001, Garrett Goebel wrote:

> On Wed, 31 Oct 2001, David Nesting wrote:
> > On Tue, Oct 30, 2001 at 09:37:39AM -0500, Aaron Sherman wrote:
> > : Yep, but in Perl5, this was never very clean or obvious to the
> > : casual programmer. Constants have been coming of age in Perl,
> > : and they're kind of scary if they're not constant.
> >
> > On one hand, one might say that a developer changing a constant's
> > binding in order to change its value is probably doing so because he
> > knows what he's doing.  As I understand things, constants are really
> > just read-only variables.  Do we necessarily want to make a special
> > case out of them and make the variable read-only as well as locking
> > down the symbol itself against re-binding?
>
> One can always turn that argument around, and say that the developer
> may want to lock down both the variable's binding and the bound
> value... because he wants to depend on it (always) doing what he wants
> it to do. What are we going to have for variable bindings?

A developer shouldn't need to lock down that binding at least for
lexically scoped vars, because what matters is the value in this case.
And as for global constants, what about:

sub MY_CONSTANT () { 1234; }

Using variables for constants in this sense seems weird to me. :-)

- D

<[EMAIL PROTECTED]>

Reply via email to