On Wed, Aug 17, 2005 at 05:31:12PM +0000, [EMAIL PROTECTED] wrote:
: Not only that, but what if what I want is a named constnat undef value?

If we went with "bind once" rather than "write once" semantics then after

    my $foo is readonly := undef;

$foo could not be rebound, but saying

    my $foo is readonly;
    $foo := bar();

could still be made to work.  But that means that $foo *as a container*
would have to remember if its value "exists" rather than relying on
the value itself knowing if it's defined.  (But that's essentially
the same distinction we make for defaults in signatures: if you pass
undef as an argument, it doesn't trigger default setting.)

In other words, you could desugar

    sub foo ($a = 1) {...}


    sub foo ($a) {
        $a = 1 unless exists $a;


Reply via email to