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? >From Exgesis 2: > > The type specification tells the compiler that $pre, $in, > and $post will only ever be used to store integer values. > And because int is in lower-case, the specification also > tells the compiler that it's okay to optimize the > implementation of the variables, because we promise not > to bless them or ascribe any run-time properties to them. Am I correct in inferring from this that: scalar $foo is constant = 0; Could not be blessed, rebound, or ascribe run-time properties?