Ken Fox writes: : Garrett Goebel wrote: : > Just does compile-time typing for $foo? Not inlining the constant? : : You can't assume that the value associated with the symbol is : the same each time through the code, so how can it be inlined? : : > I was thinking lowercase typed variables couldn't be rebound, because : > they were compile-time optimized... Can they? Or are we back to the : > selective use of yet to be named pragmas? : : Binding normally means associating a value with a symbol, so binding : to a different type depends upon whether the type information is : associated with the symbol or the value.
Yes, that is the crux of the matter. As I mumbled in A2, properties on the declaration apply to the variable, not the value. : I can't recall what Perl 6 does. I suspect that it allows binding : to change types because binding is supposed to replace messing with : globs. : : This code should work, yes? : : my int $foo; : : ... $foo is a tiny little int : : { my $bar; $foo := $bar } : : ... $foo is a big hulking scalar : : Why would sticking "const" on $foo change anything? I expect it would behave just as passing $bar to an int parameter. That is, it'd probably coerce it to an int, or complain bitterly, depending on the pragmatic context. Larry