On Sun, Sep 21, 2008 at 07:02:37PM -0700, Michael G Schwern wrote:
I'm pondering what the proper syntax is for a subroutine parameter with both a
trait and a default. That is...
sub foo ($arg = 42)
and
sub foo ($arg is readonly)
together in one parameter. Would that be
HaloO,
Patrick R. Michaud wrote:
The STD.pm grammar [1] shows that the second is the correct form --
i.e., default values occur after traits.
IIRC, there used to be an 'is default(42)' trait that could
be placed arbitrarily.
PS Incidentally, it seems silly to have is rw but not is ro. I
Patrick R. Michaud wrote:
On Sun, Sep 21, 2008 at 07:02:37PM -0700, Michael G Schwern wrote:
I'm pondering what the proper syntax is for a subroutine parameter with both
a
trait and a default. That is...
sub foo ($arg = 42)
and
sub foo ($arg is readonly)
together in one
On Sat, Jul 12, 2008 at 09:52:34PM -0500, Patrick R. Michaud wrote:
What would be the expected output from the following?
my $a = foo();
my $b;
{
my $x = 1;
sub get_x() { return $x; }
sub foo() { return get_x; }
$b = foo();
}
my