On 8/17/05, Larry Wall <[EMAIL PROTECTED]> wrote: > You could still reason about it if you can determine what the initial > value is going to be. But certainly that's not a guarantee, which > is one of the reasons we're now calling this write/bind-once behavior > "readonly" and moving true constants to a separate declarator: > > my $pi is readonly; > $pi = 3; > > vs > > constant $pi = 3; > > or > > constant Num pi = 3; > > or if you like, even > > constant π = 3;
Minor detail: when does the right side get evaluated? That is, what happens here: constant pi = make_pi(); sub make_pi() { 4*atan2(1,1) } If you want this to succeed, then this must fail: constant pi = 4*atan2(1,1); BEGIN { say "pi = {pi}" } Is it even possible to evaluate constants at CHECK time and then constant-fold them in before the program is run? Luke