Various folks have suggested that the default assignment syntax:

sub foo(?$bar is copy = 1) {...}

be considered merely a shorthand for something like:

sub foo(?$bar is copy is default(1)) {...}

thereby allowing:

sub foo(?$bar is default(1) is copy ) {...}

and hence (mirabile dictu):

sub foo(?$bar = 1 is copy ) {...}


The design team has already considered this idea, and my problem with it then (and now) is that it's inconsistent with other forms of variable declaration:

        my sub foo( ?$bar is constant = 1 ) {...}   # OKAY
        my           $bar is constant = 1;          # OKAY

        my sub foo( ?$bar = 1 is constant ) {...}   # OKAY
        my           $bar = 1 is constant;          # KABOOM!

and thereby lays a cognitive trap for programmers.

I don't know...maybe I'm worrying too much.
But then, that's part of my job. ;-)

Damian



Reply via email to