[perl #57634] [RFC] Remove ".globalconst" from PIR

Klaas-Jan Stol via RT parrotbug-followup at parrotcode.org
Sat Dec 27 15:22:40 UTC 2008


On Sat Aug 16 01:15:57 2008, allison at perl.org wrote:
> Klaas-Jan Stol wrote:
> >>
> >> Therefore, my proposal is to remove the .globalconst directive;
> >> whenever you need to have a global const, use .const outside of a
> >> subroutine.
> >> whenever you need to have a local const (in a sub), use .const 
inside a
> >> subroutine.
> 
> If we're going to remove one, let's deprecate .const outside of sub 
> blocks, and make .globalconst mean a global constant everywhere. 
> Consistency is a good thing, but so are clear distinctions between 
> similar-but-different things.
> 

I thought a bit more on this, and global .consts are more common than 
sub-local consts (I think). Following the Huffman principle, I think it 
would be nicer then to use '.localconst' for a local const, only 
available in a sub, and .const for global constants. (and thus removing 
.globalconst).

(I'm not sure where sub-local constants are stored; are they stored in 
the constants table of a PBC file? In that case the only thing 
preventing code from using a local constant in a global context would be 
the pir compiler.)

comments welcome,
kjs

> Allison
> 






More information about the parrot-dev mailing list